javascript - How do I prevent duplicate Angular keys in ng-repeat? -
having trouble duplicate keys in ng-grid. search tim click on ng grid column in gridoptions1 see duplicates in gridoptions2. ideas?
here's plnkr
$scope.gridcolumndefs2 = [ {displayname:'phone', celltemplate: '<div data-ng-repeat="(key, ngclickresult) in ngclickresults track $index">{{ngclickresult.phone}}</div>'},
i use track by
solve this, unless there reason should not, try track $index
- trick!
<div data-ng-repeat="(key, ngclickresult) in ngclickresults track $index">
or if you're trying remove items data can filter , answer here - angularjs remove duplicate elements in ng-repeat
although if use second method, unless stuck recommend trying modify data coming in before hits repeat - maybe on server if have access that.
Comments
Post a Comment