[ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify uniq

简介: [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify uniq

错误原因


今天前台接收到后台提交的数据以后,在view进行ng-reapet绑定数据的时候出现以下脚本错误:

[ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys


上面这句代码大概的意思:错误是内容相同引起的。


view中的代码是这样写的:


             <span style="font-family:SimSun;font-size:18px;"><span ng-repeat="tempExaminant in item.examinant ">{{tempExaminant}}</span></span>

小编用fiddler跟踪了一下,的确是返回的数据中有重复的数据,不知道为什么angular的指令会有这样的限制,那么如果我们必须显示重复数据怎么办呢,我们需要在ng-repeat后面添加track by $indexview中的代码改成这样:

<span style="font-family:SimSun;">     <span ng-repeat="tempExaminant in item.examinant track by $index ">{{tempExaminant}}</span></span>


这样我们就可以解决遍历重复数据问题了。

目录
相关文章
解决Mapped Statements collection already contains value for experiment4.UserMapper.listUser错误~
解决Mapped Statements collection already contains value for experiment4.UserMapper.listUser错误~
|
存储 SQL 关系型数据库
1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column的解决办法
1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column的解决办法
136 0
1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause
1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause
202 0
1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause
|
SQL 关系型数据库 MySQL
报错:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregat
报错:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregat
407 0
报错:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregat
Data Structures and Algorithms (English) - 6-10 Sort Three Distinct Keys(30 分)
Data Structures and Algorithms (English) - 6-10 Sort Three Distinct Keys(30 分)
103 0
|
C++
Data Structures and Algorithms (English) - 6-9 Sort Three Distinct Keys(20 分)
Data Structures and Algorithms (English) - 6-9 Sort Three Distinct Keys(20 分)
112 0
How to give query view parameter values in APF
How to give query view parameter values in APF
119 0
How to give query view parameter values in APF
header note truncation issue - designed behavior
header note truncation issue - designed behavior
109 0
header note truncation issue - designed behavior
Why manually change will not trigger text determination case 2
Why manually change will not trigger text determination case 2
109 0
Why manually change will not trigger text determination case 2