[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>


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

目录
相关文章
Error:Elements in iteration expect to have ‘v-bind:key‘ directives
Error:Elements in iteration expect to have ‘v-bind:key‘ directives
解决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的解决办法
244 0
成功解决ValueError: Found input variables with inconsistent numbers of samples: [86, 891]
成功解决ValueError: Found input variables with inconsistent numbers of samples: [86, 891]
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
206 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
解决办法:RuntimeError: dictionary changed size during iteration
解决办法:RuntimeError: dictionary changed size during iteration
147 0
|
缓存 数据可视化
'dict' object has no attribute '_txn_read_preference' && Sort exceeded memory limit of 10485760
'dict' object has no attribute '_txn_read_preference' && Sort exceeded memory limit of 10485760
213 0
|
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
428 0
报错:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregat
|
PHP
【PHP报错集锦】Integrity constraint violation: 1052 Column 'vt_id' in where clause is ambiguous
【PHP报错集锦】Integrity constraint violation: 1052 Column 'vt_id' in where clause is ambiguous
334 0
【PHP报错集锦】Integrity constraint violation: 1052 Column 'vt_id' in where clause is ambiguous
|
SQL 关系型数据库 MySQL
Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre
Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre
392 0