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

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -