本文介绍了在 Angularjs 中显示独特的下拉选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
限时送ChatGPT账号..我有一个工作正常的以下下拉菜单
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
虽然它应该只在选项中显示唯一 id 为...
While it should be only showing the unique id in options as...
101
119
120
121
Accounts 由 Account 的 jason 数组组成,它具有act_id(主键)ID名称名称位置
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 完全满足您的需求需要,独特的"过滤器.
AngularUI has exactly what you need, the ´unique´ filter.
示例:
ng-options="color in colors | unique:'name'"
这篇关于在 Angularjs 中显示独特的下拉选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论