角-UI-日历类型错误:无法读取的未定义的属性“长度” [英] Angular-UI-Calendar TypeError: Cannot read property 'length' of undefined

查看:314
本文介绍了角-UI-日历类型错误:无法读取的未定义的属性“长度”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我多次收到此错误,但一旦应用程序完全初始化,它工作正常。
环境:
liveaddress.js
jQuery的1.10.2
jQueryUI的1.10.4
角1.2.15(基地,-route,-cookies,-resource,-sanitize)
基础
基金会第三方物流企业 - 0.1.0
Modernizr的5.2.1
fullcalendar 1.6.4
棱角分明的UI日历0.8.0

我已经退出了这片,但没有任何变化。

源JSON看起来是这样的:

  [{称号:一个老夜Havana\",\"start\":\"2013-04-21T07:00:00Z\",\"status\":\"COMPLETED\",\"id\":\"aa4af241f9c0bc3375921a9c82f33dc6\",\"unix_start\":1366527600},{\"title\":\"A测试Event\",\"start\":\"2014-02-14T08:00:00Z\",\"status\":\"BID\",\"id\":\"fe2ce779b1817a56718aa62774f0f58b\",\"unix_start\":1392364800},{\"title\":\"A很好Party\",\"start\":\"2014-04-04T07:00:00Z\",\"status\":\"ACTIVE\",\"id\":\"5bf965595ef247a6f922b930220172ad\",\"unix_start\":1396594800},{\"title\":\"Birthday党的安妮Marie\",\"start\":\"2014-04-06T07:00:00Z\",\"status\":\"ACTIVE\",\"id\":\"5cd30308871bd4465fdcf7219707fd12\",\"unix_start\":1396767600},{\"title\":\"A测试event\",\"start\":\"2014-05-01T07:00:00Z\",\"status\":\"BID\",\"id\":\"fc1cd8ae2d328e948520d5fee695c7e3\",\"unix_start\":1398927600}]

这些错误时加载的控制发布,再次出现在接收到初始数据加载之后,每当路线发生改变,以显示日历(这是一个局部的)。

任何想法?就像我说的,最终它工作正常 - 但错误打扰我。

感谢


解决方案

您可能已经离开了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.

这篇关于角-UI-日历类型错误:无法读取的未定义的属性“长度”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆