I have created an angularjs directive, based on the example in the blog - dhtmlx.com/blog/creating-eve … angularjs/
This directive is sitting in a template that get’s loaded for a particular route in the application (/scheduler). If I go to that route and then somewhere else and back again I get an error that seems to be created by the second call to scheduler.createTimelineView.
I have added the following which checks if the scheduler has state and if not creates the timeline view.
if (!scheduler.getState().mode) {
scheduler.createTimelineView({
name: 'timeline',
x_unit: 'day',
x_date: '%D %j',
x_step: 1,
x_size: 14,
x_length: 7,
y_unit: scheduler.serverList('jobs', []),
y_property: 'job_id',
render: 'bar',
first_hour: 6,
last_hour: 18
});
}
scheduler.init($element[0], $scope.current_date.toDate(), 'timeline');
Is there a better way to init and destroy the scheduler so that it isn’t consuming resources when not active.