5

How can I make sure a complete row is unique in AngularJS?

 <tr ng-repeat="service in services" > 

I'm aware of the existing unique filter discussed here. However this only explains how to unique filter over one column. I would like to do it for on multiple columns. For example:

 <tr ng-repeat="service in services | unique:['category','type','quantity'] > 
Community
  • 1
  • 1
Gustavo Reyes
  • 1,313
  • 1
  • 17
  • 31
  • 1
    what is expected behavior? Can interpret this several ways – charlietfl Jan 16 '16 at 02:11
  • 1
    If you want the combination of *all* columns in each row to be unique, then you can use `unique` without any arguments, like `ng-repeat="service in services | unique"`, in which case the entire object will be tested for (deep) equality. If you want just a subset, the AngularUI filter doesn't support that, but you can write your own. – Igor Raush Jan 16 '16 at 03:39
  • There's plenty of examples of filtering by one key, but most of the time you need multiple. Hoping to draw some attention to this to get a viable answer. – Stephan Feb 22 '18 at 18:32

0 Answers0