angularjs 解决ng-repeat数组内重复对象报错的问题

ng-repeat 循环数组内元素时,如果数组内元素重复,angular会抛出异常: Error: [ngRepeat:dupes] http://errors.angularjs.org/1.4.3/ngRepeat/dupes?p0=record%20in%20records&p…2coachCode%22%3A%2200455532%22%2C%22%24%24hashKey%22%3A%22object%3A5%22%7D

为解决这个问题,可以在ng-repeat指令中加上track by $index,代码如下:

 <li class="item record-item" ng-repeat="record in records track by $index"></li>
上一篇:Atitit.兼具兼容性和扩展性的配置方案attilax总结


下一篇:linux下so动态库一些不为人知的秘密(中)