Reputation: 1
hi i have an api that takes its value from db. In my api i have a drop down -menu and i have certain categories like food , healthcare and in the drop down the categories gets repeated what should i do to make the drop down categories unique. And i have to do it with angular js since all the functionalities are based on angular js.
<div class="span3">
<div class="input-append">
<input class="span2" id="brandSearch" data-ng-model="brand" type="text" placeholder="Search">
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">
Brand
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<div id="divBrandId{{$index+1}}" ng-repeat="coupon in coupons | filter" onclick="javascript:assignTextValueBrand('{{$index+1}}');" onmouseover="this.style.background='violet';this.style.color='white';" onmouseout="this.style.background='white';this.style.color='black';"> {{xxxx.brand}}
</div>
</ul>
</div>
</div>
</div>
Upvotes: 0
Views: 2641
Reputation: 1000
Angular-UI has a "Unique" filter that you can use to do this. Find it here: http://angular-ui.github.io/
You can use it like this:
<div ng-repeat="coupon in coupons | unique:'brand'">
{{coupon.brand}}
</div>
Upvotes: 2