Here is the code I am currently working on:
onTabsChange(abc) {
let selected_tab = this.tabs.getSelected();
let tab_index = selected_tab.index;
console.log(tab_index); // should print current tab index but it prints previously selected tab index
}
And here is the HTML code:
<ion-tabs #myTabs class="menu" (ionChange)="onTabsChange()" selectedIndex="0">
<ion-tab [root]="blank" tabTitle="Blank"></ion-tab>
<ion-tab [root]="blank" tabTitle="Blank"></ion-tab>
<ion-tab [root]="blank" tabTitle="Blank"></ion-tab>
<ion-tab [root]="blank" tabTitle="Blank"></ion-tab>
<ion-tab [root]="blank" tabTitle="Blank"></ion-tab>
<ion-tab [root]="blank" tabTitle="Blank"></ion-tab>
<ion-tab [root]="blank" tabTitle="Blank"></ion-tab>
</ion-tabs>
When clicking on any tab, this.tabs.getSelected() returns the previously selected tab. How can I get the currently selected tab instead?