Skip to content

Commit 3c1be89

Browse files
authoredSep 22, 2021
fix(angular): select method now has correct types (#23953)
resolves #23952
1 parent 0026994 commit 3c1be89

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎angular/src/directives/navigation/ion-tabs.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ export class IonTabs {
8787
* to the default tabRootUrl
8888
*/
8989
@HostListener('ionTabButtonClick', ['$event'])
90-
select(ev: CustomEvent) {
91-
const tab = ev.detail.tab;
90+
select(tabOrEvent: string | CustomEvent) {
91+
const isTabString = typeof tabOrEvent === 'string';
92+
const tab = (isTabString) ? tabOrEvent : (tabOrEvent as CustomEvent).detail.tab;
9293
const alreadySelected = this.outlet.getActiveStackId() === tab;
9394
const tabRootUrl = `${this.outlet.tabsPrefix}/${tab}`;
9495

@@ -98,7 +99,9 @@ export class IonTabs {
9899
* will respond to this event too, causing
99100
* the app to get directed to the wrong place.
100101
*/
101-
ev.stopPropagation();
102+
if (!isTabString) {
103+
(tabOrEvent as CustomEvent).stopPropagation();
104+
}
102105

103106
if (alreadySelected) {
104107
const activeStackId = this.outlet.getActiveStackId();

0 commit comments

Comments
 (0)