Created
May 13, 2014 22:03
-
-
Save vsavkin/293a8cf339c3334bf0fd to your computer and use it in GitHub Desktop.
Dynamically Adding Routes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Injector inj = ngDynamicApp().addModule(new MyApp()).run(); | |
Router r = inj.get(Router); | |
r.root.addRoute(name: 'newRoute',path: '/new-route'); |
Adarsh J pointed out that I needed to update Dart SDK and Angular. Now I'm using Angular 0.11.0 and I can't find ngDynamicApp. Does it still exist in the latest?
Your sample https://github.com/vsavkin/angulardart-sample-app is very helpful, though I notice it is still using "type" and "value" in the Module instead of "bind".
I'm new to Dart and Angular, so I am trying to sort between what I don't know and what has changed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for that Victor!
I see that this way of bootstrapping is new since 0.9.11?
My AppModule is coming up with "type", "value" and "factory" is deprecated.
class AppModule extends Module {
AppModule() {
type(AppController);
type(Project);
type(QueryService);
value(RouteInitializerFn, routerInitializer);
factory(NgRoutingUsePushState,
(_) => new NgRoutingUsePushState.value(false));
}
}
I'm having trouble finding a clean example of the new way of bootstrapping. Can you please point me in the right direction?
Thanks for your time!