UNPKG

ui-select

Version:
72 lines (70 loc) 4.24 kB
<p> <button class="btn btn-default btn-xs" ng-click="ctrl.enable()">Enable ui-select</button> <button class="btn btn-default btn-xs" ng-click="ctrl.disable()">Disable ui-select</button> <code>ctrl.disabled {{ctrl.disabled | json}}</code> </p> <p> <button class="btn btn-default btn-xs" ng-click="ctrl.enableSearch()">Enable Search</button> <button class="btn btn-default btn-xs" ng-click="ctrl.disableSearch()">Disable Search</button> <code>ctrl.searchEnabled {{ ctrl.searchEnabled | json }}</code> </p> <p> <button class="btn btn-default btn-xs" ng-click="ctrl.clear()">Clear ng-model</button> </p> <h3>Bootstrap theme</h3> <p>Selected: {{ctrl.person.selected}}</p> <ui-select ng-model="ctrl.person.selected" theme="bootstrap" search-enabled="ctrl.searchEnabled" ng-disabled="ctrl.disabled" style="min-width: 300px;" title="Choose a person"> <ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</ui-select-match> <ui-select-choices repeat="person in ctrl.people | propsFilter: {name: $select.search, age: $select.search}"> <div ng-bind-html="person.name | highlight: $select.search"></div> <small> email: {{person.email}} age: <span ng-bind-html="''+person.age | highlight: $select.search"></span> </small> </ui-select-choices> </ui-select> <hr /> <p>Number Selected: {{ctrl.multipleDemo.selectedPeople.length}}</p> <ui-select multiple ng-model="ctrl.multipleDemo.selectedPeople" theme="bootstrap" search-enabled="ctrl.searchEnabled" ng-disabled="ctrl.disabled" style="min-width: 300px;" title="Choose a person"> <ui-select-match placeholder="Select person...">{{$item.name}} &lt;{{$item.email}}&gt;</ui-select-match> <ui-select-choices repeat="person in ctrl.people | propsFilter: {name: $select.search, age: $select.search}"> <div ng-bind-html="person.name | highlight: $select.search"></div> <small> email: {{person.email}} age: <span ng-bind-html="''+person.age | highlight: $select.search"></span> </small> </ui-select-choices> </ui-select> <h3>Select2 theme</h3> <p>Selected: {{ctrl.person.selected}}</p> <ui-select ng-model="ctrl.person.selected" theme="select2" search-enabled="ctrl.searchEnabled" ng-disabled="ctrl.disabled" style="min-width: 300px;"> <ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</ui-select-match> <ui-select-choices repeat="person in ctrl.people | propsFilter: {name: $select.search, age: $select.search}"> <div ng-bind-html="person.name | highlight: $select.search"></div> <small> email: {{person.email}} age: <span ng-bind-html="''+person.age | highlight: $select.search"></span> </small> </ui-select-choices> </ui-select> <hr /> <p>Number Selected: {{ctrl.multipleDemo.selectedPeople.length}}</p> <ui-select multiple ng-model="ctrl.multipleDemo.selectedPeople" theme="select2" search-enabled="ctrl.searchEnabled" ng-disabled="ctrl.disabled" style="min-width: 300px;"> <ui-select-match placeholder="Select person...">{{$item.name}} &lt;{{$item.email}}&gt;</ui-select-match> <ui-select-choices repeat="person in ctrl.people | propsFilter: {name: $select.search, age: $select.search}"> <div ng-bind-html="person.name | highlight: $select.search"></div> <small> email: {{person.email}} age: <span ng-bind-html="''+person.age | highlight: $select.search"></span> </small> </ui-select-choices> </ui-select> <h3>Selectize theme</h3> <p>Selected: {{ctrl.country.selected}}</p> <ui-select ng-model="ctrl.country.selected" theme="selectize" search-enabled="ctrl.searchEnabled" ng-disabled="ctrl.disabled" style="width: 300px;"> <ui-select-match placeholder="Select or search a country in the list...">{{$select.selected.name}}</ui-select-match> <ui-select-choices repeat="country in ctrl.countries | filter: $select.search"> <span ng-bind-html="country.name | highlight: $select.search"></span> <small ng-bind-html="country.code | highlight: $select.search"></small> </ui-select-choices> </ui-select>