Answer the question
In order to leave comments, you need to log in
How to remove duplicate items in select when using Angular?
A list of products is taken from the database, each product has a category, which may be the same for some products.
In select they are inserted like this:
<select ng-model="chooseCat">
<option ng-repeat="item in Items">{{item.cat}}</option>
</select>
Answer the question
In order to leave comments, you need to log in
Need a uniqueness filter on the category unique:'cat'
<select
ng-options="item as item.cat for item in Items | unique:'cat' track by item.cat"
ng-model="chooseCat">
</select>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question