80084

Angular-UI-Calendar TypeError: Cannot read property 'length' of undefined

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

Answer1:

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.

Recommend

  • how to scrape content using scrapy which have same class name
  • writing a service to periodically retrieve XML and send SMS
  • rake task memory leak
  • What is the proper Java Config for simple file copy
  • Model with transparency
  • Simulate click event on select (not working for IE and FF)
  • How to split column into two in R using separate [duplicate]
  • Create and import mysql database on shared host in php
  • Describe relationship in maximo 7.5
  • printing a float with runtime-selectable precision
  • How to save a model when using MXnet
  • Appending to existing SQLite table when addition has fewer columns, without reading database into R
  • looping through pairs of input files [duplicate]
  • PayPal REST API cross reference transaction with payment
  • How can I use functools.partial on multiple methods on an object, and freeze parameters out of order
  • Is it possible to disable certain weekdays in DatePickerDialog?
  • Regarding client side code generation from WSDL
  • Representing intervals or ranges? [closed]
  • How to get month name with year and list of years between two Date
  • Using Generics on right hand side in Java 6?
  • Find Previous month name using Calender or any classes that in java
  • Play WS (2.2.1): post/put large request
  • Could not find rake using whenever rails
  • Display issues when we change from one jquery mobile page to another in firefox
  • Different response to non-authenticated users and AJAX calls
  • Counter field in MS Access, how to generate?
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • WinForms: two way TextBox problem
  • Javascript + PHP Encryption with pidCrypt
  • Websockets service method fails during R startup
  • To display the title for the current loaction in map in iphone
  • jQuery tmpl and DataLink beta
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • Calling of Constructors in a Java
  • Traverse Array and Display in markup
  • Transpose CSV data with awk (pivot transformation)
  • trying to dynamically update Highchart column chart but series undefined
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • Is it possible to post an object from jquery to bottle.py?
  • Unable to use reactive element in my shiny app