ui-select icon indicating copy to clipboard operation
ui-select copied to clipboard

Problem Enabling/Disabling Buttons

Open erslater opened this issue 11 years ago • 2 comments

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?

erslater avatar Dec 05 '14 16:12 erslater

working demo http://plnkr.co/edit/Lg8xzWUPlonGe9ClmuKt?p=preview

olegweb avatar Dec 08 '14 20:12 olegweb

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.

erslater avatar Dec 12 '14 14:12 erslater