NG-重复残疾选项中进行选择 [英] ng-repeat select with disabled options
本文介绍了NG-重复残疾选项中进行选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有阵
vm.helpersIterator = [ ] //store new <select>-s
和对象这样
vm.helpersObj = {
2014: {name: 'test', selected: true},
1290: {name: 'test1', selected: false},
}
HTML
<select name="helper" class="form-control"
ng-repeat="helper in vm.helpersIterator track by $index">
<option value="">- Select helper -</option>
<option ng-repeat="(uid, helper) in vm.helpersObj"
ng-value="uid"
ng-selected="helper.selected">
{{helper.name}}
</option>
</select>
我就可以把许多&LT;选择&GT;
-s在vm.helpersIterator阵列。
但我需要禁用它已经选定的选项。
I'll can push many <select>
-s in vm.helpersIterator array.
But I need to disable options which already been selected.
您可以看到我的理解所附图片。
You can see my attached picture for understand.
推荐答案
NG-停用
会做你想做的。
下面是一个工作例子plunkr,类似于你的。
Here is a plunkr with a working example, similar to yours.
http://plnkr.co/edit/YLXFVbndqAaPV4mMsynR?p=$p$ PVIEW
我也用 NG-变化
用于设置selectedOption为选
I also used ng-change
for setting the selectedOption as selected
这篇关于NG-重复残疾选项中进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文