fix(router): handle router outlets in ngIf
This commit is contained in:
@ -83,9 +83,12 @@ export class RouterLink {
|
||||
return true;
|
||||
}
|
||||
|
||||
this.router.navigate(
|
||||
this.urlTree = this.router.createUrlTreeUsingFutureUrl(
|
||||
this.commands,
|
||||
{relativeTo: this.route, queryParams: this.queryParams, fragment: this.fragment});
|
||||
|
||||
this.router.navigateByUrl(this.urlTree);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -147,9 +150,10 @@ export class RouterLinkWithHref implements OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
private updateTargetUrlAndHref(): void {
|
||||
this.urlTree = this.router.createUrlTree(
|
||||
this.urlTree = this.router.createUrlTreeUsingFutureUrl(
|
||||
this.commands,
|
||||
{relativeTo: this.route, queryParams: this.queryParams, fragment: this.fragment});
|
||||
|
||||
if (this.urlTree) {
|
||||
this.href = this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.urlTree));
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ export class RouterOutlet {
|
||||
} catch (e) {
|
||||
if (!(e instanceof NoComponentFactoryError)) throw e;
|
||||
|
||||
// TODO: vsavkin uncomment this once CompoentResolver is deprecated
|
||||
// TODO: vsavkin uncomment this once ComponentResolver is deprecated
|
||||
// const componentName = component ? component.name : null;
|
||||
// console.warn(
|
||||
// `'${componentName}' not found in precompile array. To ensure all components referred
|
||||
@ -84,5 +84,6 @@ export class RouterOutlet {
|
||||
|
||||
const inj = ReflectiveInjector.fromResolvedProviders(providers, this.location.parentInjector);
|
||||
this.activated = this.location.createComponent(factory, this.location.length, inj, []);
|
||||
this.activated.changeDetectorRef.detectChanges();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user