我使用嵌套的 ng-repeat 在 html 页面中显示我的数据。
报错
Error: Error: 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations
但这个错误不会影响我的功能。我正在寻找这个问题的答案,但我没有得到正确的答案,所以我在这里发布了这个问题。
我不知道我的 json 数据结构是否导致此错误,但我无法更改其结构。
这是我的示例 json 数据
//In controller
for (var i = 1; i <= 31; i++) {
$scope.daysofmonth.push({day:i}); // daysofmonth.day->1,2,3...
}
for(var j=0; j<$scope.daysofmonth.length; j++) {
$scope.daysofmonth[j].events = [ // creating 31 arrays for events
{"name":"T", "count":0,"data":[{
"startDate":"01/25/2013",
"startTime":"00:00",
"endDate":"01/26/2013",
"endTime":"00:00",
"type":"m",
"status":"Not Started",
"title":"Demo to Client",
"description":"Application demo"
}]},
{"name":"I", "count":0,"data":[...]} // same as previous
];
//left some of the business logic
}
//In html file
<div class="{{box | today:year+'-'+month+'-'+dayofmonth.day:dayofmonth.day}}" ng-repeat="dayofmonth in daysofmonth" >
<span class="days">{{ dayofmonth.day }}</span>
<span class="events-list">
<div ng-repeat="eve in dayofmonth.events" >
{{ eve.count + eve.name }}
</div>
</span>
</div>
任何人都可以告诉我导致此错误的原因以及解决方法吗?
最佳答案
该 JSON 无效。此外,您的模板不会输出任何可见的内容,除非您在转发器中放置一些绑定(bind)标签,例如 {{ Company.Company.id }}
。
关于angularjs - 由于angularjs中的ng-repeat而出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14500388/