Angular-UI-Calendar TypeError:无法读取未定义的属性“长度" [英] Angular-UI-Calendar TypeError: Cannot read property 'length' of undefined

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

问题描述

我反复收到此错误,尽管一旦应用程序完全初始化,它就可以正常工作.环境:liveaddress.jsjQuery 1.10.2jqueryui 1.10.4角度 1.2.15 (base, -route, -cookies, -resource, -sanitize)基础基础-tpls-0.1.0现代化 5.2.1全日历 1.6.4角度用户界面日历 0.8.0

我已经提取了其中的一部分,但没有任何变化.

源 JSON 如下所示:

[{"title":"哈瓦那老城之夜","start":"2013-04-21T07:00:00Z","status":"COMPLETED","id":"aa4af241f9c0bc3375921a9c82f33dc6","unix_start":1366527600},{"title":"一个测试事件","start":"2014-02-14T08:00:00Z","status":"BID","id":"fe2ce779b1817a56718af0f527b","unix_start":1392364800},{"title":"非常好的派对","start":"2014-04-04T07:00:00Z","status":"ACTIVE","id":"5bf965595ef247a6f922b930220172ad","unix_start":1396594800},{"title":"安妮玛丽的生日派对","start":"2014-04-06T07:00:00Z:","ACTIVEusstat""id",":"5cd30308871bd4465fdcf7219707fd12","unix_start":1396767600},{"title":"一个测试事件","start":"2014-05-01T07:00:00Z","ID"status":":"fc1cd8ae2d328e948520d5fee695c7e3","unix_start":1398927600}]

错误在加载控件时发布,在收到初始数据加载后再次发生,以及每当更改路线以显示日历(部分).

有什么想法吗?就像我说的,最终它运行良好 - 但错误困扰着我.

谢谢

解决方案

您可能在 ui-calendar 元素上遗漏了模型.来自 文档:

<块引用>

需要创建一个事件源对象以传递到 ng-model.将监视此对象的更改并相应地更新日历,从而为日历提供一些 Angular Magic.

...

这里是 FullCalendar eventSources 的链接 docs.

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.

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

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