Is there any way to get the active tab index in Ionic 2? I have searched, in Ionic 1 there is $ionicTabsDelegate.
Pass the event object to your method:
<ion-tabs (ionChange)="tabSelected($event)">
The event object is actually the selected Tab
:
tabSelected(tab: Tab) {
console.log(tab.index);
}
Your navController should link to the nested Tab which has a property 'index'.
console.log((<Tab>this.navCtrl).index);
I think this is a little hacky so I'm happy to see other answers. But for the moment you could try that :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With