1

我尝试使用 angular-ui-bootstrap datepicker,它让我心烦意乱,萤火虫控制台(Firefox 21)上出现错误说

Error: array is undefined
indexOf@http://localhost:9000/components/angular/angular.js:526
arrayRemove@http://localhost:9000/components/angular/angular.js:535
JQLiteUnbind@http://localhost:9000/components/angular/angular.js:1630
JQLite.prototype[name]@http://localhost:9000/components/angular/angular.js:2203
.link/<@http://localhost:9000/components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.min.js:1
Scope.prototype.$digest@http://localhost:9000/components/angular/angular.js:7942
Scope.prototype.$apply@http://localhost:9000/components/angular/angular.js:8143
done@http://localhost:9000/components/angular/angular.js:9170
completeRequest@http://localhost:9000/components/angular/angular.js:9333
createHttpBackend/</xhr.onreadystatechange@http://localhost:9000/components/angular/angular.js:9304

http://localhost:9000/components/angular/angular.js
Line 5754

检查每个日期选择器设置后,我检查了文档中的给定示例,点击链接“在 plunker 上编辑它”,我得到了类似的错误。

Error: array is undefined
indexOf@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:510
arrayRemove@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:519
JQLiteUnbind@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:1596
JQLite.prototype[name]@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:2149
.link/<@http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.5.0.js:1229
Scope.prototype.$digest@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:7878
Scope.prototype.$apply@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:8079
bootstrap/<@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:962
invoke@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:2843
bootstrap@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:961
angularInit@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:936
@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:14729
trigger@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:1723
createEventHandler/eventHandler/<@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:1958
forEach@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:133
createEventHandler/eventHandler@http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:1957

http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js
Line 5687

然后我尝试了 Chrome 版本 26.0.1410.63,我得到了一个不同的错误

TypeError: Cannot read property 'indexOf' of undefined
at indexOf (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:510:12)
at arrayRemove (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:519:15)
at JQLiteUnbind (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:1596:7)
at Object.JQLite.(anonymous function) [as unbind] (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:2149:17)
at Object.fn (http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.5.0.js:1229:21)
at Object.Scope.$digest (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:7878:27)
at Object.Scope.$apply (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:8079:24)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:962:13
at Object.invoke (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:2843:25)
at bootstrap (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:960:12) 

它有效,但错误消息让我很不安,我认为这是我的代码有问题。

我可以假设这与给出的示例无关,而是与一些内部结构有关,还是该示例缺少某些内容?

4

1 回答 1

3

ui-bootstrap 0.5.0 有一个错误,

(它试图取消绑定“焦点”事件处理程序,但处理程序不存在) https://github.com/angular-ui/bootstrap/blob/gh-pages/ui-bootstrap-tpls-0.5.0.js# L1226

您可以应用此更改 https://github.com/angular-ui/bootstrap/commit/bf30898da27272df75f6c7ff26545ed16ebf1978

或者直接从github构建

或等待 0.6.0

于 2013-08-13T17:00:45.203 回答