mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
fix(angular): URL based tabs
This commit is contained in:
@ -23,7 +23,7 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
|
||||
private parentContexts: ChildrenOutletContexts,
|
||||
private location: ViewContainerRef,
|
||||
private resolver: ComponentFactoryResolver,
|
||||
elementRef: ElementRef,
|
||||
private elementRef: ElementRef,
|
||||
@Attribute('name') name: string,
|
||||
@Optional() @Attribute('stack') stack: any,
|
||||
private changeDetector: ChangeDetectorRef,
|
||||
@ -142,6 +142,8 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
|
||||
const direction = this.navCtrl.consumeDirection();
|
||||
await this.stackCtrl.setActive(enteringView, direction);
|
||||
this.activateEvents.emit(this.activated.instance);
|
||||
|
||||
emitEvent(this.elementRef.nativeElement);
|
||||
}
|
||||
|
||||
canGoBack(deep = 1) {
|
||||
@ -153,6 +155,15 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
function emitEvent(el: HTMLElement) {
|
||||
console.log('ionRouterOutletActivated');
|
||||
const event = new CustomEvent('ionRouterOutletActivated', {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
});
|
||||
el.dispatchEvent(event);
|
||||
}
|
||||
|
||||
class OutletInjector implements Injector {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
|
@ -16,7 +16,7 @@ export class TabDelegate {
|
||||
elementRef.nativeElement.delegate = angularDelegate.create(cfr, injector);
|
||||
}
|
||||
|
||||
@HostListener('ionNavDidChange')
|
||||
@HostListener('ionRouterOutletActivated', ['$event'])
|
||||
async onNavChanged() {
|
||||
const tab = this.elementRef.nativeElement as HTMLIonTabElement;
|
||||
await tab.componentOnReady();
|
||||
|
Reference in New Issue
Block a user