[英]ng-repeat duplicated on item change
I have an angular application with sets of array items "array_var". 我有一个带有数组项“ array_var”集的角度应用程序。 When I push new sets of array to array_var, I noticed that the ng-repeat in my html creates a duplicate ng-repeat. 当我将新的数组集推送到array_var时,我注意到html中的ng-repeat创建了重复的ng-repeat。
everytime I push new array to the array_var there is also another duplicate ng-repeat created. 每次我将新数组推送到array_var时,还会创建另一个重复的ng-repeat。 Sample ng-repeat: 样本ng-repeat:
<div ng-repeat="d in icons track by $index" class="icons-holder">
<div class="col-lg-12 col-md-12 col-sm-12 sub-category text-center" ng-hide="d.date == icons[$index-1].date">
<div class="searchTag-holder pad-left-25 pad-right-25 d-inline-b">
<ul>
<li class="searchTag">
{! d.date !}
</li>
</ul>
</div>
</div>
</div>
The repeated attribute is normal in this feature, you can see the example here: https://www.w3schools.com/angular/tryit.asp?filename=try_ng_ng-repeat2 (Inspect element) If you want to avoid that attribute you could repeat the element with pure javascript/typescript. 重复属性在此功能中是正常的,您可以在此处查看示例: https ://www.w3schools.com/angular/tryit.asp ? filename = try_ng_ng- repeat2 (检查元素)如果要避免使用该属性,可以使用纯javascript / typescript重复该元素。
This link has more details: https://www.w3schools.com/angular/ng_ng-repeat.asp 该链接具有更多详细信息: https : //www.w3schools.com/angular/ng_ng-repeat.asp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.