From 8407cfeac76fd05c91aa079e648b72e7aa66a8cd Mon Sep 17 00:00:00 2001 From: vsavkin Date: Tue, 31 May 2016 08:48:53 -0700 Subject: [PATCH] fix(router): fix router to take root component type instead of instance --- modules/@angular/router/src/router.ts | 6 +++--- modules/@angular/router/test/router.spec.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/@angular/router/src/router.ts b/modules/@angular/router/src/router.ts index a1afbe0982..8022dcf0fe 100644 --- a/modules/@angular/router/src/router.ts +++ b/modules/@angular/router/src/router.ts @@ -1,4 +1,4 @@ -import { ComponentResolver, ReflectiveInjector } from '@angular/core'; +import { ComponentResolver, ReflectiveInjector, Type } from '@angular/core'; import { Location } from '@angular/common'; import { UrlSerializer } from './url_serializer'; import { RouterOutletMap } from './router_outlet_map'; @@ -33,9 +33,9 @@ export class Router { /** * @internal */ - constructor(private rootComponent:Object, private resolver: ComponentResolver, private urlSerializer: UrlSerializer, private outletMap: RouterOutletMap, private location: Location) { + constructor(private roorComponentType:Type, private resolver: ComponentResolver, private urlSerializer: UrlSerializer, private outletMap: RouterOutletMap, private location: Location) { this.currentUrlTree = createEmptyUrlTree(); - this.currentRouterState = createEmptyState(rootComponent.constructor); + this.currentRouterState = createEmptyState(roorComponentType); this.setUpLocationChangeListener(); this.navigateByUrl(this.location.path()); } diff --git a/modules/@angular/router/test/router.spec.ts b/modules/@angular/router/test/router.spec.ts index 6a7259c772..5783c36653 100644 --- a/modules/@angular/router/test/router.spec.ts +++ b/modules/@angular/router/test/router.spec.ts @@ -27,7 +27,7 @@ describe("Integration", () => { { provide: Router, useFactory: (resolver, urlSerializer, outletMap, location) => - new Router(new RootCmp(), resolver, urlSerializer, outletMap, location), + new Router(RootCmp, resolver, urlSerializer, outletMap, location), deps: [ComponentResolver, UrlSerializer, RouterOutletMap, Location] }, {provide: ActivatedRoute, useFactory: (r) => r.routerState.root, deps: [Router]},