fix(router): add an app initializer to trigger initial navigation

Closes #10
This commit is contained in:
vsavkin
2016-06-06 14:05:57 -07:00
parent 5742d4720a
commit b0e7c14545
3 changed files with 13 additions and 4 deletions

View File

@ -63,8 +63,14 @@ export class Router {
*/
constructor(private rootComponentType:Type, private resolver: ComponentResolver, private urlSerializer: UrlSerializer, private outletMap: RouterOutletMap, private location: Location, private injector: Injector, private config: RouterConfig) {
this.routerEvents = new Subject<Event>();
this.currentUrlTree = createEmptyUrlTree();
this.currentRouterState = createEmptyState(rootComponentType);
this.currentUrlTree = createEmptyUrlTree()
this.currentRouterState = createEmptyState(this.rootComponentType);
}
/**
* @internal
*/
initialNavigation():void {
this.setUpLocationChangeListener();
this.navigateByUrl(this.location.path());
}