angularjs - 由于angularjs中的ng-repeat而出错

标签 angularjs

我使用嵌套的 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/

相关文章:

javascript - indexof - 检查一个值是否已经在 javascript 数组中)

javascript - Angular js 有没有办法对函数的执行顺序进行排序

javascript - 按顺序打开 Angular 应用程序页面 - 第二个 page.open 回调不会被调用

javascript - 我无法将数据从 AngularJS 发送到 Spring MVC Controller

javascript - Angular 中的 ng-repeat 递归

angularjs - 复制并替换 Electron 版中的数据库文件

javascript - 如果我将一个元素从一个容器移动到另一个容器,是否存在范围问题?

javascript - UI 路由器 $stateParams 是只读的

javascript - angularjs:ui-router(嵌套 View )和引导选项卡玩得不好

angularjs - AngularJS 项目中的 Grunt Karma 单元任务失败