[Ionic 4] - Get current Tab selected


#1

On Ionic 4 I am not able to understand on how to get the current selected tab… below is the html code …

//HTML
<ion-tabs #myTabs (ionChange)="tabSwitched(myTabs)"></ion-tabs>
//TS 
tabSwitched(myTabs) {
    console.log(myTabs.getSelected());
    // this.events.publish('refresh:channels', Date.now());
  }
//Output comes up like this and I am not sure how to get through the selected Id.

Is this the right approach :slight_smile: or am I doing something wrong here…requesting anyone to please help!

Thanks in advance!


Remove hashbangs from URL
#2

Try:

<ion-tabs>
  <ion-tab tabIcon="contact" [root]="tabCustomers" (ionSelect)="doSomething()"></ion-tab>
</ion-tabs>

#3

Thank you so much !!! :slight_smile: