I will switch my application to the new DSL routing. In particular, I want to do something like this with preEnter :
final RouteInitializerFn routes =(Router router, ViewFactory views) { views.configure({ 'chat': ngRoute( path: '/chat', // authService.requireState returns a Future<bool>, and may invoke an HttpRequest preEnter: (RoutePreEnterEvent e) => e.allowEnter(authService.requireState(LOGGED_IN)), view: 'views/chat.html'), 'login': ngRoute( path: '', defaultRoute: true, view: 'views/login.html') }); }
This will be configured in the module as follows:
value(RouteInitializerFn, routes);
If you missed it, I refer to the injectable authService in RouteInitializerFn . This is not possible because RouteInitializerFn is a function, not a class, so you cannot enter anything into it. If I encapsulated the routes function inside the class, I'm not sure how I could configure RouteInitializerFn , so I am a bit difficult.
dart angular-dart
w.brian
source share