ui-select
ui-select copied to clipboard
Problem Enabling/Disabling Buttons
I have the following html:
<div class="input-group">
<ui-select ng-model="selectedTerritory">
<ui-select-match placeholder="Select or search for a territory...">
{{$select.selected.description}}
</ui-select-match>
<ui-select-choices repeat="item in territories | filter: $select.search">
<span ng-bind-html="item.description | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
<span class="input-group-btn">
<button type="button"
ng-click="selectedTerritory = undefined"
ng-disabled="selectedTerritory == undefined" class="btn btn-default">
<i class="fa fa-ban"></i>
</button>
</span>
</div>
The problem is that the button remains disabled even after selecting a territory. Am I just missing something obvious or is there an issue?
working demo http://plnkr.co/edit/Lg8xzWUPlonGe9ClmuKt?p=preview
I changed the binding to selected.territory from selectedTerritory and it worked. Not sure why you need to bind to an object as opposed to a property but that corrected it.