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

fixes #16411
This commit is contained in:
octicon-git-branch(16/)
octicon-tag(16/)
Manu MA
2018-12-17 01:49:56 +01:00
committed by GitHub
gitea-unlock(16/)
parent b5efedeb1c
commit 35e3848d96
octicon-diff(16/tw-mr-1) 14 changed files with 113 additions and 5 deletions

4
angular/src/directives/navigation/ion-router-outlet.ts
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 {

7
angular/src/directives/navigation/stack-controller.ts
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);
}