问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/23066056/angular-ui-calendar-typeerror-cannot-read-property-length-of-undefined