且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

角-UI-日历类型错误:无法读取的未定义的属性“长度”

更新时间:2022-10-29 17:13:51

您可能已经离开了UI日历元素模型。从文档


  要创建

这是事件源对象需要传递到NG-模式。这个对象将被观察的变化并相应更新日历,给日历中的某些角度魔术队。


  
  

...

 <格UI日历=calendarOptionsNG模型=eventSources日历=myCalendar>


块引用>

这是对FullCalendar的链接 eventSources 文档

I'm getting this error repeatedly, although once the app fully initializes, it works fine. Environment: liveaddress.js jquery 1.10.2 jqueryui 1.10.4 angular 1.2.15 (base, -route, -cookies, -resource, -sanitize) foundation foundation-tpls-0.1.0 modernizr 5.2.1 fullcalendar 1.6.4 angular-ui-calendar 0.8.0

I've pulled out pieces of this, but no change.

The source JSON looks like this:

[{"title":"A Night in Old Havana","start":"2013-04-21T07:00:00Z","status":"COMPLETED","id":"aa4af241f9c0bc3375921a9c82f33dc6","unix_start":1366527600},{"title":"A Test Event","start":"2014-02-14T08:00:00Z","status":"BID","id":"fe2ce779b1817a56718aa62774f0f58b","unix_start":1392364800},{"title":"A Very Nice Party","start":"2014-04-04T07:00:00Z","status":"ACTIVE","id":"5bf965595ef247a6f922b930220172ad","unix_start":1396594800},{"title":"Birthday Party for Anne Marie","start":"2014-04-06T07:00:00Z","status":"ACTIVE","id":"5cd30308871bd4465fdcf7219707fd12","unix_start":1396767600},{"title":"A test event","start":"2014-05-01T07:00:00Z","status":"BID","id":"fc1cd8ae2d328e948520d5fee695c7e3","unix_start":1398927600}]

The errors are posted when the control is loaded, occur again after the initial data load is received, and whenever the route is changed to show the calendar (which is on a partial).

Any ideas? Like I said, ultimately it works fine - but the errors bother me.

Thanks

You probably left out the model on the ui-calendar element. From the docs:

An Event Sources objects needs to be created to pass into ng-model. This object will be watched for changes and update the calendar accordingly, giving the calendar some Angular Magic.

...

<div ui-calendar="calendarOptions" ng-model="eventSources" calendar="myCalendar">

And here is a link to the FullCalendar eventSources docs.