forked from felixmosh/ui-select
-
Notifications
You must be signed in to change notification settings - Fork 3
/
demo-event-on-selection.html
26 lines (23 loc) · 1.24 KB
/
demo-event-on-selection.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
<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>
<h3>Event on Select</h3>
<p>Selected: {{ctrl.person.selected}}</p>
<ui-select ng-model="ctrl.person.selected" theme="select2" on-select="ctrl.onSelectCallback($item, $model)" 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.email as 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 />
<h3>Event Result</h3>
<p>Called <code>{{ctrl.counter+0}}</code> times</p>
<p>Parameters</p>
<pre>
$model = {{ ctrl.eventResult.model | json }}
$item = {{ ctrl.eventResult.item | json }}
</pre>