forked from angular-ui/ui-select
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo-focus.html
47 lines (44 loc) · 2.71 KB
/
demo-focus.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<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>
<button class="btn btn-default btn-xs" ng-click="ctrl.clear()">Clear ng-model</button>
<h1>Focus</h1>
<p>Regular uiSelect</p>
<ui-select ng-model="ctrl.person.selected" theme="select2" 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>
<h3>Autofocus</h3>
<p>Use the <code>autofocus</code> attribute to automatically focus ui-select when the page is loaded</p>
<ui-select autofocus ng-model="ctrl.person.selected" theme="select2" 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>
<h3>Focus on Demand</h3>
<p>Use the <code>focus-on</code> attribute, defining a scope event name (<code>UiSelectDemo1</code>) to listen for, to manually trigger focussing of ui-select.</p>
<ui-select focus-on="UiSelectDemo1" ng-model="ctrl.person.selected" theme="select2" 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>
<p></p>
<p>
<button class="btn btn-default" ng-click="ctrl.setInputFocus()">Set Focus</button>
(<code>$scope.$broadcast('UiSelectDemo1');</code>)
</p>