angularjs - how to have ui-select placeholder return when ui-select is disabled -
i using ui-select dropdown select follows example demo code closely. ui-select working great. adding angular-material checkbox. intent have checkbox enable/disable dropdown select. setting ng-disabled property of ui-select element state variable use in checkbox. working fine, when uncheck box, dropdown select disabled, when check box, dropdown select enabled.
i want default placeholder (when no items have been selected yet) return whenever dropdown select disabled. is, after selecting dropdown item, displayed in ui-select replacing default placeholder. when dropdown select disabled, want placeholder replace selected item. way when dropdown enabled again, starts placeholder. have tried different approached, not conversant enough angular work. if enable clear functionality, 'x' , indeed clear selection , return placeholder, need programatically checkbox callback.
so how force placeholder of ui-select element togglesession click callback of checkbox element?
i impressed angular, painful trying re-train old thinking/habits head around how code angular way.
anyway, appreciated. working code:
<ui-select class="vic-session-select" ng-model="session.selected" theme="select2" ng-disabled="!usesession"> <ui-select-match placeholder="select session or search name..."> {{$select.selected.date}} - {{$select.selected.name}} </ui-select-match> <ui-select-choices repeat="session in sessions | propsfilter: {name: $select.search, date: $select.search}"> <div class="vic-overlay-select-list-item" ng-bind-html="session.date | highlight: $select.search"></div> <span> - </span> <div class="vic-overlay-select-list-item" ng-bind-html="session.name | highlight: $select.search"></div> </ui-select-choices> <ui-select> <md-checkbox class="vic-use-session-queue-checkbox" aria-label="session checkbox" ng-checked="usesession" ng-click="togglesession()"> <span class="vic-session-checkbox-label">use predefined session overlays</span> </md-checkbox>
Comments
Post a Comment