【发布时间】:2014-06-13 18:33:50
【问题描述】:
我确定我做错了什么,但即使在 Angular.js 上调试我也找不到错误
我在这里学习 Angular 基础教程:https://docs.angularjs.org/tutorial/step_03 教程中的所有示例都可以正常工作。 但是我想尝试一些很酷的功能,并自己在第 3 步的示例中添加了代码
索引.html: https://gist.github.com/tario/f07239992eea75535421
controller.js https://gist.github.com/tario/1b6155b5c97e747abe32
过滤器在这里定义:https://gist.github.com/tario/1b6155b5c97e747abe32#file-controllers-js-L16
只要我使用复选框启用大写,就会产生以下错误:
错误:[$rootScope:infdig] 达到了 10 个 $digest() 迭代。中止! 观察者在最后 5 次迭代中触发: [["fn: $watchCollectionWatch; newVal: 62; oldVal: 59"],["fn: $watchCollectionWatch; newVal: 65; oldVal: 62"],["fn: $watchCollectionWatch; newVal: 68; oldVal: 65"],["fn: $watchCollectionWatch; newVal: 71; oldVal: 68"],["fn: $watchCollectionWatch; newVal: 74; oldVal: 71"]] http://errors.angularjs.org/1.2.17/$rootScope/infdig?p0=10&p1=%5B%5B%22fn%3…20%24watchCollectionWatch%3B%20newVal%3A%2074%3B%20oldVal%3A%2071%22%5D%5D 在http://xxxxxxx.doesntexists.com:8000/app/bower_components/angular/angular.js:78:12 在 Scope.$get.Scope.$digest (http://xxxxxxx.doesntexists.com:8000/app/bower_components/angular/angular.js:12396:19) 在 Scope.$get.Scope.$apply (http://xxxxxxx.doesntexists.com:8000/app/bower_components/angular/angular.js:12622:24) 在 HTMLInputElement。 (http://xxxxxxx.doesntexists.com:8000/app/bower_components/angular/angular.js:17016:11) 在http://xxxxxxx.doesntexists.com:8000/app/bower_components/angular/angular.js:2810:10 在 Array.forEach (本机) 在 forEach (http://xxxxxxx.doesntexists.com:8000/app/bower_components/angular/angular.js:320:11) 在 HTMLInputElement.eventHandler (http://xxxxxxx.doesntexists.com:8000/app/bower_components/angular/angular.js:2809:5)
我不知道以这种方式进行过滤是否是最佳做法,但我想知道为什么会失败,因为我唯一要做的就是使用另一个数组的转换内容创建一个新数组,没关系???
【问题讨论】:
-
如果我的回答对您有用,欢迎采纳。否则,如果您对它有任何疑问,我很乐意对其进行编辑。
标签: javascript angularjs angularjs-scope