From aa198cd3f3b59bb985b85e66d62485a809f0275a Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Mon, 20 Sep 2021 11:03:35 -0400 Subject: [PATCH] fix(angular): select method now has correct types --- angular/src/directives/navigation/ion-tabs.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/angular/src/directives/navigation/ion-tabs.ts b/angular/src/directives/navigation/ion-tabs.ts index af4dc7a6a4b..65969802464 100644 --- a/angular/src/directives/navigation/ion-tabs.ts +++ b/angular/src/directives/navigation/ion-tabs.ts @@ -87,8 +87,9 @@ export class IonTabs { * to the default tabRootUrl */ @HostListener('ionTabButtonClick', ['$event']) - select(ev: CustomEvent) { - const tab = ev.detail.tab; + select(tabOrEvent: string | CustomEvent) { + const isTabString = typeof tabOrEvent === 'string'; + const tab = (isTabString) ? tabOrEvent : (tabOrEvent as CustomEvent).detail.tab; const alreadySelected = this.outlet.getActiveStackId() === tab; const tabRootUrl = `${this.outlet.tabsPrefix}/${tab}`; @@ -98,7 +99,9 @@ export class IonTabs { * will respond to this event too, causing * the app to get directed to the wrong place. */ - ev.stopPropagation(); + if (!isTabString) { + (tabOrEvent as CustomEvent).stopPropagation(); + } if (alreadySelected) { const activeStackId = this.outlet.getActiveStackId();