Reputation: 5813
I am using angular ui select https://github.com/angular-ui/ui-select in my project. I am using ui-select
directive
My code:
<select class="input-small" ng-model="dashboard.style" ng-options="f for f in ['light','hpexp']" ng-change="styleUpdated()"></select>
I want to use ui-select So I did,
<ui-select id="viewSelector"
class="viewSelector input-small"
ng-model="dashboard.style"
ng-options="f for f in ['light','hpexp']"
ng-change="styleUpdated()"
theme="selectize">
<ui-select-match placeholder="-- Select --">
{{$select.style}}</ui-select-match>
</ui-select>
But it is not working. How to use ng-options
in ui-select
Thanks!!
Upvotes: 1
Views: 7008
Reputation: 38713
Please use ui-select-choices
instead of ng-options
. Lets try the below code, instead of yours
<ui-select id="viewSelector"
class="viewSelector input-small"
ng-model="dashboard.style"
ng-change="styleUpdated()"
theme="selectize">
<ui-select-match placeholder="-- Select --">
{{$select.style}}</ui-select-match>
<ui-select-choices repeat="f for f in ['light','hpexp']">
<div ng-bind-html="f"></div>
</ui-select-choices>
</ui-select>
More details, please read this discussion
Angularjs and UI-Select: how to select an option from code
Upvotes: 1