@@ -168,50 +168,32 @@ main() {
168
168
}
169
169
170
170
class FlatRouteInitializer implements Function {
171
- void call (Router router, RouteViewFactory view) {
172
- router.root
173
- ..addRoute (
174
- name: 'foo' ,
175
- path: '/foo' ,
176
- enter: view ('foo.html' ))
177
- ..addRoute (
178
- name: 'bar' ,
179
- path: '/bar' ,
180
- enter: view ('bar.html' ))
181
- ..addRoute (
182
- name: 'baz' ,
183
- path: '/baz' ); // route without a template
171
+ void call (Router router, RouteViewFactory views) {
172
+ views.configure ({
173
+ 'foo' : ngRoute (path: '/foo' , view: 'foo.html' ),
174
+ 'bar' : ngRoute (path: '/bar' , view: 'bar.html' ),
175
+ 'baz' : ngRoute (path: '/baz' ),
176
+ });
184
177
}
185
178
}
186
179
187
180
class NestedRouteInitializer implements Function {
188
- void call (Router router, RouteViewFactory view) {
189
- router.root
190
- ..addRoute (
191
- name: 'library' ,
181
+ void call (Router router, RouteViewFactory views) {
182
+ views.configure ({
183
+ 'library' : ngRoute (
192
184
path: '/library' ,
193
- enter: view ('library.html' ),
194
- mount: (Route route) => route
195
- ..addRoute (
196
- name: 'all' ,
197
- path: '/all' ,
198
- enter: view ('book_list.html' ))
199
- ..addRoute (
200
- name: 'book' ,
201
- path: '/:bookId' ,
202
- mount: (Route route) => route
203
- ..addRoute (
204
- name: 'overview' ,
205
- path: '/overview' ,
206
- defaultRoute: true ,
207
- enter: view ('book_overview.html' ))
208
- ..addRoute (
209
- name: 'read' ,
210
- path: '/read' ,
211
- enter: view ('book_read.html' ))))
212
- ..addRoute (
213
- name: 'admin' ,
214
- path: '/admin' ,
215
- enter: view ('admin.html' ));
185
+ view: 'library.html' ,
186
+ mount: {
187
+ 'all' : ngRoute (path: '/all' , view: 'book_list.html' ),
188
+ 'book' : ngRoute (
189
+ path: '/:bookId' ,
190
+ mount: {
191
+ 'overview' : ngRoute (path: '/overview' , view: 'book_overview.html' ,
192
+ defaultRoute: true ),
193
+ 'read' : ngRoute (path: '/read' , view: 'book_read.html' ),
194
+ 'admin' : ngRoute (path: '/admin' , view: 'admin.html' ),
195
+ })
196
+ })
197
+ });
216
198
}
217
199
}
0 commit comments