'Disable a field in ui-select(multiple choice) based on selection of another field in same ui-select
Let's say I have a multiple ui-select with options ["cat","lion","dog","pig","horse"]. If I select "cat", I want to disable "dog". And if I select "dog", I want to disable "cat".
<ui-select required multiple ng-model="selectedFilter.myModel" style="min-width: 50%; max-width: 50%" theme="select2" close-on-select="false" on-select="updateVariableChanged(selectedFilter.myModel)" title="Select the variable to be updated" ng-disabled="!selectedVar.myModel">
<ui-select-match placeholder="Select variable...">{{$item.name}}
</ui-select-match>
<ui-select-choices repeat="variable.name as variable in variables | propsFilter: {name: $select.search, type: $select.search}">
<div ng-bind-html="variable.name | highlight: $select.search"></div>
<span ng-bind-html="variable.type | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
This is how my ui-select looks right now. I think I can use the selectedFilter.myModel for checking the value selected. Then I can disable the other value. But I don't know how to disable something using value.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
