-
Notifications
You must be signed in to change notification settings - Fork 0
/
select.html
70 lines (62 loc) · 1.54 KB
/
select.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!doctype html>
<html>
<head>
<script src="libs/angular.js"></script>
<script src="libs/ui-bootstrap-tpls-0.12.0.js"></script>
<script src="components/riaSelect.js"></script>
<link href="css/bootstrap.css" rel="stylesheet">
<style>
body {
margin: 100px;
}
.select {
width: auto;
}
</style>
</head>
<body ng-app="app">
<div ng-controller="Ctrl">
<div>{{info.person.value}}</div>
<select
class="select"
ng-model="info.person"
ng-options="person.label for person in persons">
</select>
<button ng-click="info.person=persons[2]">update</button>
<hr>
<div>{{info.person.value}}</div>
<div ria-select options="persons"
selected="info.person">
</div>
<button class="btn btn-default btn-sm" ng-click="info.person=persons[1]">update</button>
<hr>
<div>{{info.people}}</div>
<div ria-select options="peoples"
selected="info.people"></div>
<span>
<button class="btn btn-default btn-sm" ng-click="info.people = 'Kite'">update</button>
</span>
</div>
<script>
angular
.module('app', ['ui.bootstrap', 'directives'])
.controller('Ctrl', function($scope) {
$scope.persons = [{
label: 'Very long user name',
value: 2001
}, {
label: 'Tom',
value: 2002
}, {
label: 'Kite',
value: 2003
}];
$scope.peoples = ['Jim', 'Tom', 'Kite'];
$scope.info = {
person: $scope.persons[0],
people: $scope.peoples[1]
};
})
</script>
</body>
</html>