I have an array with list of items.Some items are duplicates.I need the way to make those items as unique.I know of using track by $index in ng-repeat of angularjs.But i want to use the array without trackby.as a regular ng-repeat.
Array=[
{ name:'john',salary:'2000'},{ name:'john',salary:'2000'},{ name:'john',salary:'2000'},{ name:'harry',salary:'2000'}]
Is there any way I can do it in controller of the angularjs.I tried adding new field to the array Like this:
for(x in Array){
Array[x].unique=x;
}
But it givessame value to all the duplicate items. Any way to resolve this.