angularjs 报错:[ngRepeat:dupes]

转自:http://blog.csdn.net/zml6308/article/details/38312347

 

在ng-repeat 中迭代的元素值重复,可能导致报错::[ngRepeat:dupes]

 

<div ng-init="words = ['高校','高校','高校']" ng-repeat="word in words track by $index">
    {{word}}
</div>

 

 

在ng-repeat后面加上

 track by $index

你可能感兴趣的:(AngularJS)