Cannot read property '0' of undefined

Hello,
I have a little problem when I try to display the calendar with AngularJs. I followed this tutorial dhtmlx.com/blog/?p=2060

here is the error message displayed on the console:

TypeError: Cannot read property ‘0’ of undefined
at Object.scheduler.render_view_data (localhost:3000/libraries/schedul … js:1854:58)
at Object.scheduler.update_view (localhost:3000/libraries/schedul … js:1307:10)
at Object.scheduler.updateView (localhost:3000/libraries/schedul … js:1331:22)
at Object.scheduler.setCurrentView (localhost:3000/libraries/schedul … s:1335:111)
at Object.scheduler.init (localhost:3000/libraries/schedul … .js:970:10)
at link (localhost:3000/javascripts/sched … r.js:56:17)
at K (localhost:3000/libraries/angular … js:1168:35)
at f (localhost:3000/libraries/angular … js:983:105)
at K (localhost:3000/libraries/angular … js:1165:26)
at f (localhost:3000/libraries/angular … js:983:135) <div data=“events” dhx-scheduler=“dhx-scheduler” style=“height: 800px; width: 1400px;” class="dhx_cal_container dhx_scheduler_Fri Dec 13 2013

14:26:03 GMT+0100 (CET)"> angular.min.js:1946
(anonymous function) angular.min.js:1946
(anonymous function) angular.min.js:1441
K angular.min.js:1170
f angular.min.js:983
K angular.min.js:1165
f angular.min.js:983
f angular.min.js:983
(anonymous function) angular.min.js:964
(anonymous function) angular.min.js:334
h.$eval angular.min.js:2378
h.$apply angular.min.js:2389
(anonymous function) angular.min.js:332
d angular.min.js:667
Xb.c angular.min.js:331
Xb angular.min.js:339
Rc angular.min.js:315
(anonymous function) angular.min.js:4499
a angular.min.js:3145
(anonymous function) angular.min.js:567
q angular.min.js:25
Xc.c angular.min.js:565

and this is what I have (it works fine) but I still get the errors above.
Do you have an idea about what causes this?
thanks :wink:


Hello, TypeError: Cannot read property '0' of undefined This error usually happens if you specify incorrect mode for the scheduler.

For example, if you open a basic example from scheduler package, you can see line like following:

scheduler.init('scheduler_here',new Date(2010,0,10),"week");

If you change mode name (the third argument, “week” view) to something invalid, you’ll see the same error you get now scheduler.init('scheduler_here',new Date(2010,0,10),"_week_");//will trigger "TypeError: Cannot read property '0' of undefined"
So make sure you provide the correct view name when calling scheduler.init. The default modes (that always exists in the calendar) are ‘day’, ‘week’, ‘month’

Thank you man ! it works fine now :wink: