dhtmlxScheduler:Cannot read property '0' of undefined


While following this dhtmlx.github.io/angular-scheduler-demo/

angular.js:14324 TypeError: Cannot read property ‘0’ of undefined
at Object.scheduler._reset_scale (dhtmlxscheduler.js:109)
at Object.scheduler.update_view (dhtmlxscheduler.js:101)
at Object.scheduler.updateView (dhtmlxscheduler.js:103)
at Object.scheduler.setCurrentView (dhtmlxscheduler.js:103)
at Object.scheduler.init (dhtmlxscheduler.js:69)
at ScheduleDhxDirectiveController.$onInit (scheduler.dhx.directive.js:80)
at eval (angular.js:9596)
at forEach (angular.js:365)
at nodeLinkFn (angular.js:9585)
at compositeLinkFn (angular.js:8878)


It seems like it happens because of incorrect arguments order for “scheduler.init” function.
Init function second argument is date and third one is scheduler mode. ( docs.dhtmlx.com/scheduler/api__ … _init.html )
See following pull request with fix: github.com/DHTMLX/angular-sched … 263f4a2be8
You could get this demo from GitHub. github.com/DHTMLX/angular-scheduler-demo

I have fixed the issue by using an timeout. Since the code is in es6 , i have wrote it inside onInit.

this.$timeout(()=>{ scheduler.init(this.$element[0], new Date(), "month"); },200)