@@ -40,37 +40,39 @@ app.filter('propsFilter', function() {
40
40
} ;
41
41
} ) ;
42
42
43
- app . controller ( 'DemoCtrl' , function ( $scope , $http , $timeout , $interval ) {
44
- $scope . disabled = undefined ;
45
- $scope . searchEnabled = undefined ;
43
+ app . controller ( 'DemoCtrl' , function ( $scope , $http , $timeout , $interval ) {
44
+ var vm = this ;
46
45
47
- $scope . setInputFocus = function ( ) {
46
+ vm . disabled = undefined ;
47
+ vm . searchEnabled = undefined ;
48
+
49
+ vm . setInputFocus = function ( ) {
48
50
$scope . $broadcast ( 'UiSelectDemo1' ) ;
49
51
} ;
50
52
51
- $scope . enable = function ( ) {
52
- $scope . disabled = false ;
53
+ vm . enable = function ( ) {
54
+ vm . disabled = false ;
53
55
} ;
54
56
55
- $scope . disable = function ( ) {
56
- $scope . disabled = true ;
57
+ vm . disable = function ( ) {
58
+ vm . disabled = true ;
57
59
} ;
58
60
59
- $scope . enableSearch = function ( ) {
60
- $scope . searchEnabled = true ;
61
+ vm . enableSearch = function ( ) {
62
+ vm . searchEnabled = true ;
61
63
} ;
62
64
63
- $scope . disableSearch = function ( ) {
64
- $scope . searchEnabled = false ;
65
+ vm . disableSearch = function ( ) {
66
+ vm . searchEnabled = false ;
65
67
} ;
66
68
67
- $scope . clear = function ( ) {
68
- $scope . person . selected = undefined ;
69
- $scope . address . selected = undefined ;
70
- $scope . country . selected = undefined ;
69
+ vm . clear = function ( ) {
70
+ vm . person . selected = undefined ;
71
+ vm . address . selected = undefined ;
72
+ vm . country . selected = undefined ;
71
73
} ;
72
74
73
- $scope . someGroupFn = function ( item ) {
75
+ vm . someGroupFn = function ( item ) {
74
76
75
77
if ( item . name [ 0 ] >= 'A' && item . name [ 0 ] <= 'M' )
76
78
return 'From A - M' ;
@@ -80,19 +82,19 @@ app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
80
82
81
83
} ;
82
84
83
- $scope . firstLetterGroupFn = function ( item ) {
85
+ vm . firstLetterGroupFn = function ( item ) {
84
86
return item . name [ 0 ] ;
85
87
} ;
86
88
87
- $scope . reverseOrderFilterFn = function ( groups ) {
89
+ vm . reverseOrderFilterFn = function ( groups ) {
88
90
return groups . reverse ( ) ;
89
91
} ;
90
92
91
- $scope . personAsync = { selected : "wladimir@email.com" } ;
92
- $scope . peopleAsync = [ ] ;
93
+ vm . personAsync = { selected : "wladimir@email.com" } ;
94
+ vm . peopleAsync = [ ] ;
93
95
94
96
$timeout ( function ( ) {
95
- $scope . peopleAsync = [
97
+ vm . peopleAsync = [
96
98
{ name : 'Adam' , email : 'adam@email.com' , age : 12 , country : 'United States' } ,
97
99
{ name : 'Amalie' , email : 'amalie@email.com' , age : 12 , country : 'Argentina' } ,
98
100
{ name : 'Estefanía' , email : 'estefania@email.com' , age : 21 , country : 'Argentina' } ,
@@ -106,20 +108,20 @@ app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
106
108
] ;
107
109
} , 3000 ) ;
108
110
109
- $scope . counter = 0 ;
110
- $scope . onSelectCallback = function ( item , model ) {
111
- $scope . counter ++ ;
112
- $scope . eventResult = { item : item , model : model } ;
111
+ vm . counter = 0 ;
112
+ vm . onSelectCallback = function ( item , model ) {
113
+ vm . counter ++ ;
114
+ vm . eventResult = { item : item , model : model } ;
113
115
} ;
114
116
115
- $scope . removed = function ( item , model ) {
116
- $scope . lastRemoved = {
117
+ vm . removed = function ( item , model ) {
118
+ vm . lastRemoved = {
117
119
item : item ,
118
120
model : model
119
121
} ;
120
122
} ;
121
123
122
- $scope . tagTransform = function ( newTag ) {
124
+ vm . tagTransform = function ( newTag ) {
123
125
var item = {
124
126
name : newTag ,
125
127
email : newTag . toLowerCase ( ) + '@email.com' ,
@@ -130,7 +132,7 @@ app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
130
132
return item ;
131
133
} ;
132
134
133
- $scope . peopleObj = {
135
+ vm . peopleObj = {
134
136
'1' : { name : 'Adam' , email : 'adam@email.com' , age : 12 , country : 'United States' } ,
135
137
'2' : { name : 'Amalie' , email : 'amalie@email.com' , age : 12 , country : 'Argentina' } ,
136
138
'3' : { name : 'Estefanía' , email : 'estefania@email.com' , age : 21 , country : 'Argentina' } ,
@@ -143,13 +145,13 @@ app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
143
145
'10' : { name : 'Nicolás' , email : 'nicolas@email.com' , age : 43 , country : 'Colombia' }
144
146
} ;
145
147
146
- $scope . person = { } ;
148
+ vm . person = { } ;
147
149
148
- $scope . person . selectedValue = $scope . peopleObj [ 3 ] ;
149
- $scope . person . selectedSingle = 'Samantha' ;
150
- $scope . person . selectedSingleKey = '5' ;
150
+ vm . person . selectedValue = vm . peopleObj [ 3 ] ;
151
+ vm . person . selectedSingle = 'Samantha' ;
152
+ vm . person . selectedSingleKey = '5' ;
151
153
152
- $scope . people = [
154
+ vm . people = [
153
155
{ name : 'Adam' , email : 'adam@email.com' , age : 12 , country : 'United States' } ,
154
156
{ name : 'Amalie' , email : 'amalie@email.com' , age : 12 , country : 'Argentina' } ,
155
157
{ name : 'Estefanía' , email : 'estefania@email.com' , age : 21 , country : 'Argentina' } ,
@@ -162,23 +164,23 @@ app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
162
164
{ name : 'Nicolás' , email : 'nicolas@email.com' , age : 43 , country : 'Colombia' }
163
165
] ;
164
166
165
- $scope . availableColors = [ 'Red' , 'Green' , 'Blue' , 'Yellow' , 'Magenta' , 'Maroon' , 'Umbra' , 'Turquoise' ] ;
167
+ vm . availableColors = [ 'Red' , 'Green' , 'Blue' , 'Yellow' , 'Magenta' , 'Maroon' , 'Umbra' , 'Turquoise' ] ;
166
168
167
- $scope . singleDemo = { } ;
168
- $scope . singleDemo . color = '' ;
169
- $scope . multipleDemo = { } ;
170
- $scope . multipleDemo . colors = [ 'Blue' , 'Red' ] ;
171
- $scope . multipleDemo . colors2 = [ 'Blue' , 'Red' ] ;
172
- $scope . multipleDemo . selectedPeople = [ $scope . people [ 5 ] , $scope . people [ 4 ] ] ;
173
- $scope . multipleDemo . selectedPeople2 = $scope . multipleDemo . selectedPeople ;
174
- $scope . multipleDemo . selectedPeopleWithGroupBy = [ $scope . people [ 8 ] , $scope . people [ 6 ] ] ;
175
- $scope . multipleDemo . selectedPeopleSimple = [ 'samantha@email.com' , 'wladimir@email.com' ] ;
169
+ vm . singleDemo = { } ;
170
+ vm . singleDemo . color = '' ;
171
+ vm . multipleDemo = { } ;
172
+ vm . multipleDemo . colors = [ 'Blue' , 'Red' ] ;
173
+ vm . multipleDemo . colors2 = [ 'Blue' , 'Red' ] ;
174
+ vm . multipleDemo . selectedPeople = [ vm . people [ 5 ] , vm . people [ 4 ] ] ;
175
+ vm . multipleDemo . selectedPeople2 = vm . multipleDemo . selectedPeople ;
176
+ vm . multipleDemo . selectedPeopleWithGroupBy = [ vm . people [ 8 ] , vm . people [ 6 ] ] ;
177
+ vm . multipleDemo . selectedPeopleSimple = [ 'samantha@email.com' , 'wladimir@email.com' ] ;
176
178
177
- $scope . appendToBodyDemo = {
179
+ vm . appendToBodyDemo = {
178
180
remainingToggleTime : 0 ,
179
181
present : true ,
180
182
startToggleTimer : function ( ) {
181
- var scope = $scope . appendToBodyDemo ;
183
+ var scope = vm . appendToBodyDemo ;
182
184
var promise = $interval ( function ( ) {
183
185
if ( scope . remainingTime < 1000 ) {
184
186
$interval . cancel ( promise ) ;
@@ -192,26 +194,26 @@ app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
192
194
}
193
195
} ;
194
196
195
- $scope . address = { } ;
196
- $scope . refreshAddresses = function ( address ) {
197
+ vm . address = { } ;
198
+ vm . refreshAddresses = function ( address ) {
197
199
var params = { address : address , sensor : false } ;
198
200
return $http . get (
199
201
'http://maps.googleapis.com/maps/api/geocode/json' ,
200
202
{ params : params }
201
203
) . then ( function ( response ) {
202
- $scope . addresses = response . data . results ;
204
+ vm . addresses = response . data . results ;
203
205
} ) ;
204
206
} ;
205
207
206
- $scope . addPerson = function ( item , model ) {
208
+ vm . addPerson = function ( item , model ) {
207
209
if ( item . hasOwnProperty ( 'isTag' ) ) {
208
210
delete item . isTag ;
209
- $scope . people . push ( item ) ;
211
+ vm . people . push ( item ) ;
210
212
}
211
213
}
212
214
213
- $scope . country = { } ;
214
- $scope . countries = [ // Taken from https://gist.github.com/unceus/6501985
215
+ vm . country = { } ;
216
+ vm . countries = [ // Taken from https://gist.github.com/unceus/6501985
215
217
{ name : 'Afghanistan' , code : 'AF' } ,
216
218
{ name : 'Åland Islands' , code : 'AX' } ,
217
219
{ name : 'Albania' , code : 'AL' } ,
0 commit comments