显示Angularjs独特的下拉选项 [英] Showing unique dropdown options in Angularjs
本文介绍了显示Angularjs独特的下拉选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下下拉这是工作的罚款
I have a following drop down which is working fine
<select class="form-control" ng-model="cc.id">
<option value="">Chose Id</option>
<option ng-repeat="account in accounts |unique:'id'" value="{{account.id}}">{{name.id}}</option>
</select>
这让我在下面的下拉选项
It gives me following options in the dropdown
101
101
119
120
121
121
尽管应该只显示为...
While it should be only showing the unique id in options as...
101
119
120
121
帐户由贾森阵列帐户其中有
act_id(主键)
ID
FNAME
LNAME
位置
Accounts consists of jason array of Account which has act_id (primary key) id fname lname location
你能告诉我如何解决对ID唯一的过滤器,以便只显示唯一值感谢
Can you please tell me how to fix the unique filter on id so that it displays only unique values Thanks
推荐答案
AngularUI 有什么你需要时,'unique'过滤器。
AngularUI has exactly what you need, the ´unique´ filter.
例如:
ng-options="color in colors | unique:'name'"
这篇关于显示Angularjs独特的下拉选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文