How can I programmatically select specific Ionic tab (in typescript file)? For example if I have in template…
I’m using Ionic 8 and Angular 18
<ion-tabs>
<ion-tab-bar slot="bottom" >
<ion-tab-button tab="home">
<ion-icon name="home"></ion-icon> Home
</ion-tab-button>
<ion-tab-button tab="favorites">
<ion-icon name="heart"></ion-icon> Favorites
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
How can I programmatically select home tab?
I have tried with @ViewChild but without success:
@ViewChild('tabs', {static: true}) tabs:IonTabs | undefined;
and than
this.tabs?.select('home')
but it is not working. The error I get is…
TypeError: Cannot read properties of undefined (reading ‘getActiveStackId’)
Regards
Darshan Hiranandani