@BrentAshWilliams wrote:
Hello,
I have a page with tabs. I have a button on the first tab that when pushed I would like to route/select another tab.
The high level html has the following:
<ion-tabs #my_profile_tabs> <ion-tab-bar slot="bottom" color="dark" > <ion-tab-button tab="tab1"> <ion-label>Tab 1</ion-label> </ion-tab-button> <ion-tab-button tab="tab2"> <ion-label>Tab 2</ion-label> </ion-tab-button> <ion-tab-button tab="tab3"> <ion-label>Tab 3</ion-label> </ion-tab-button> <ion-tab-button tab="tab4"> <ion-label>Tab 4</ion-label> </ion-tab-button> </ion-tab-bar> </ion-tabs>
In tab 1’s component I have the following:
@ViewChild(‘my_profile_tabs’) tabRef: IonTabs;
On a button click event on the tab 1 I try the following:
this.tabRef.select('tab4');
When the click event occurs tabRef is undefined:
ERROR TypeError: Cannot read property 'select' of undefined
Any thoughts on what I am doing wrong?
Posts: 1
Participants: 1