fix(angular): fix sibling router-outlets (#16774)

fixes #16411
This commit is contained in:
Manu MA
2018-12-17 01:49:56 +01:00
committed by GitHub
parent b5efedeb1c
commit 35e3848d96
14 changed files with 113 additions and 5 deletions

View File

@ -62,13 +62,11 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
this.name = name || PRIMARY_OUTLET;
this.tabsPrefix = tabs === 'true' ? getUrl(router, activatedRoute) : undefined;
this.stackCtrl = new StackController(this.tabsPrefix, this.nativeEl, router, navCtrl, zone);
parentContexts.onChildOutletCreated(this.name, this as any);
}
ngOnDestroy(): void {
console.log('router-outlet destroyed');
this.parentContexts.onChildOutletDestroyed(this.name);
this.stackCtrl.destroy();
}
getContext(): OutletContext | null {

View File

@ -94,6 +94,13 @@ export class StackController {
return this.activeView ? this.activeView.stackId : undefined;
}
destroy() {
this.containerEl = undefined!;
this.views.forEach(destroyView);
this.activeView = undefined;
this.views = [];
}
private getStack(stackId: string | undefined) {
return this.views.filter(v => v.stackId === stackId);
}