Skip to content

Instantly share code, notes, and snippets.

@vsavkin
Created May 13, 2014 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vsavkin/293a8cf339c3334bf0fd to your computer and use it in GitHub Desktop.
Save vsavkin/293a8cf339c3334bf0fd to your computer and use it in GitHub Desktop.
Dynamically Adding Routes
Injector inj = ngDynamicApp().addModule(new MyApp()).run();
Router r = inj.get(Router);
r.root.addRoute(name: 'newRoute',path: '/new-route');
@asherritt
Copy link

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!

@asherritt
Copy link

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