我使用嵌套的 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>
谁能告诉我是什么导致了这个错误以及如何解决它?