@@ -107,7 +107,6 @@ <h2>Welcome to Ionic</h2>
107
107
< ion-nav-view name = "tab-account" > </ ion-nav-view >
108
108
</ ion-tab >
109
109
110
-
111
110
</ ion-tabs >
112
111
</ script >
113
112
@@ -139,7 +138,7 @@ <h2>Welcome to Ionic</h2>
139
138
$stateProvider
140
139
141
140
// setup an abstract state for the tabs directive
142
- . state ( 'tab' , {
141
+ . state ( 'tab' , {
143
142
url : '/tab' ,
144
143
abstract : true ,
145
144
templateUrl : 'templates/tabs.html'
@@ -158,23 +157,24 @@ <h2>Welcome to Ionic</h2>
158
157
} )
159
158
160
159
. state ( 'tab.chats' , {
161
- url : '/chats' ,
162
- views : {
163
- 'tab-chats' : {
164
- templateUrl : 'templates/tab-chats.html' ,
165
- controller : 'ChatsCtrl'
166
- }
160
+ url : '/chats' ,
161
+ views : {
162
+ 'tab-chats' : {
163
+ templateUrl : 'templates/tab-chats.html' ,
164
+ controller : 'ChatsCtrl'
167
165
}
168
- } )
169
- . state ( 'tab.chat-detail' , {
170
- url : '/chats/:chatId' ,
171
- views : {
172
- 'tab-chats' : {
173
- templateUrl : 'templates/chat-detail.html' ,
174
- controller : 'ChatDetailCtrl'
175
- }
166
+ }
167
+ } )
168
+
169
+ . state ( 'tab.chat-detail' , {
170
+ url : '/chats/:chatId' ,
171
+ views : {
172
+ 'tab-chats' : {
173
+ templateUrl : 'templates/chat-detail.html' ,
174
+ controller : 'ChatDetailCtrl'
176
175
}
177
- } )
176
+ }
177
+ } )
178
178
179
179
. state ( 'tab.account' , {
180
180
url : '/account' ,
@@ -193,84 +193,83 @@ <h2>Welcome to Ionic</h2>
193
193
194
194
angular . module ( 'starter.controllers' , [ ] )
195
195
196
- . controller ( 'DashCtrl' , function ( $scope ) { } )
197
-
198
- . controller ( 'ChatsCtrl' , function ( $scope , Chats ) {
199
- // With the new view caching in Ionic, Controllers are only called
200
- // when they are recreated or on app start, instead of every page change.
201
- // To listen for when this page is active (for example, to refresh data),
202
- // listen for the $ionicView.enter event:
203
- //
204
- //$scope.$on('$ionicView.enter', function(e) {
205
- //});
206
-
207
- $scope . chats = Chats . all ( ) ;
208
- $scope . remove = function ( chat ) {
209
- Chats . remove ( chat ) ;
210
- } ;
211
- } )
212
-
213
- . controller ( 'ChatDetailCtrl' , function ( $scope , $stateParams , Chats ) {
214
- $scope . chat = Chats . get ( $stateParams . chatId ) ;
215
- } )
216
-
217
- . controller ( 'AccountCtrl' , function ( $scope ) {
218
- $scope . settings = {
219
- enableFriends : true
220
- } ;
221
- } ) ;
222
-
223
- angular . module ( 'starter.services' , [ ] )
224
-
225
- . factory ( 'Chats' , function ( ) {
226
- // Might use a resource here that returns a JSON array
227
-
228
- // Some fake testing data
229
- var chats = [ {
230
- id : 0 ,
231
- name : 'Ben Sparrow' ,
232
- lastText : 'You on your way?' ,
233
- face : 'img/ben.png'
234
- } , {
235
- id : 1 ,
236
- name : 'Max Lynx' ,
237
- lastText : 'Hey, it\'s me' ,
238
- face : 'img/max.png'
239
- } , {
240
- id : 2 ,
241
- name : 'Adam Bradleyson' ,
242
- lastText : 'I should buy a boat' ,
243
- face : 'img/adam.jpg'
244
- } , {
245
- id : 3 ,
246
- name : 'Perry Governor' ,
247
- lastText : 'Look at my mukluks!' ,
248
- face : 'img/perry.png'
249
- } , {
250
- id : 4 ,
251
- name : 'Mike Harrington' ,
252
- lastText : 'This is wicked good ice cream.' ,
253
- face : 'img/mike.png'
254
- } ] ;
255
-
256
- return {
257
- all : function ( ) {
258
- return chats ;
259
- } ,
260
- remove : function ( chat ) {
261
- chats . splice ( chats . indexOf ( chat ) , 1 ) ;
262
- } ,
263
- get : function ( chatId ) {
264
- for ( var i = 0 ; i < chats . length ; i ++ ) {
265
- if ( chats [ i ] . id === parseInt ( chatId ) ) {
266
- return chats [ i ] ;
196
+ . controller ( 'DashCtrl' , function ( $scope ) { } )
197
+
198
+ . controller ( 'ChatsCtrl' , function ( $scope , Chats ) {
199
+ // With the new view caching in Ionic, Controllers are only called
200
+ // when they are recreated or on app start, instead of every page change.
201
+ // To listen for when this page is active (for example, to refresh data),
202
+ // listen for the $ionicView.enter event:
203
+ //
204
+ //$scope.$on('$ionicView.enter', function(e) {
205
+ //});
206
+
207
+ $scope . chats = Chats . all ( ) ;
208
+ $scope . remove = function ( chat ) {
209
+ Chats . remove ( chat ) ;
210
+ } ;
211
+ } )
212
+
213
+ . controller ( 'ChatDetailCtrl' , function ( $scope , $stateParams , Chats ) {
214
+ $scope . chat = Chats . get ( $stateParams . chatId ) ;
215
+ } )
216
+
217
+ . controller ( 'AccountCtrl' , function ( $scope ) {
218
+ $scope . settings = {
219
+ enableFriends : true
220
+ } ;
221
+ } ) ;
222
+
223
+ angular . module ( 'starter.services' , [ ] )
224
+
225
+ . factory ( 'Chats' , function ( ) {
226
+ // Might use a resource here that returns a JSON array
227
+
228
+ // Some fake testing data
229
+ var chats = [ {
230
+ id : 0 ,
231
+ name : 'Ben Sparrow' ,
232
+ lastText : 'You on your way?' ,
233
+ face : 'img/ben.png'
234
+ } , {
235
+ id : 1 ,
236
+ name : 'Max Lynx' ,
237
+ lastText : 'Hey, it\'s me' ,
238
+ face : 'img/max.png'
239
+ } , {
240
+ id : 2 ,
241
+ name : 'Adam Bradleyson' ,
242
+ lastText : 'I should buy a boat' ,
243
+ face : 'img/adam.jpg'
244
+ } , {
245
+ id : 3 ,
246
+ name : 'Perry Governor' ,
247
+ lastText : 'Look at my mukluks!' ,
248
+ face : 'img/perry.png'
249
+ } , {
250
+ id : 4 ,
251
+ name : 'Mike Harrington' ,
252
+ lastText : 'This is wicked good ice cream.' ,
253
+ face : 'img/mike.png'
254
+ } ] ;
255
+
256
+ return {
257
+ all : function ( ) {
258
+ return chats ;
259
+ } ,
260
+ remove : function ( chat ) {
261
+ chats . splice ( chats . indexOf ( chat ) , 1 ) ;
262
+ } ,
263
+ get : function ( chatId ) {
264
+ for ( var i = 0 ; i < chats . length ; i ++ ) {
265
+ if ( chats [ i ] . id === parseInt ( chatId ) ) {
266
+ return chats [ i ] ;
267
+ }
267
268
}
269
+ return null ;
268
270
}
269
- return null ;
270
- }
271
- } ;
272
- } ) ;
273
-
271
+ } ;
272
+ } ) ;
274
273
275
274
</ script >
276
275
0 commit comments