refactor(router): Switch from using APP_COMPONENT binding to a manual ROUTER_PRIMARY_COMPONENT binding.
With the coming bootstrapping changes, a single application (and thus Router) can have multiple root components. One of these needs to be identified as the "primary" component from which the Router will load its configuration. This is now done by providing a ROUTER_PRIMARY_COMPONENT binding to the primary component type.
This commit is contained in:
@ -457,13 +457,12 @@ export class Router {
|
||||
export class RootRouter extends Router {
|
||||
_location: Location;
|
||||
|
||||
constructor(registry: RouteRegistry, location: Location, hostComponent: Type) {
|
||||
super(registry, null, hostComponent);
|
||||
constructor(registry: RouteRegistry, location: Location, primaryComponent: Type) {
|
||||
super(registry, null, primaryComponent);
|
||||
this._location = location;
|
||||
this._location.subscribe((change) =>
|
||||
this.navigateByUrl(change['url'], isPresent(change['pop'])));
|
||||
|
||||
this.registry.configFromComponent(hostComponent);
|
||||
this.registry.configFromComponent(primaryComponent);
|
||||
this.navigateByUrl(location.path());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user