angular 中 ng-repeat循环有相同值的数组时

xiaoxiao2021-02-28  103

angular中,如果一个数组中有相同的值如  [4,5,4,6]中'4'就是重复的....这时候如果用ng-repeat来循环的话,就会报错.....官网给出的解决办法是  ng-repeat = 'n in [4,5,4,6] track by $index'  这样就不会报错了.能完美输出重复的数组元素了

转载请注明原文地址: https://www.6miu.com/read-30430.html

最新回复(0)