Is there a way to get the index of the active tab in Ionic 2? I searched in Ionic 1 there is $ ionicTabsDelegate.
Pass the event object to your method:
<ion-tabs (ionChange)="tabSelected($event)">
The event object is actually selected Tab:
Tab
tabSelected(tab: Tab) { console.log(tab.index); }
Your navController must reference a nested Tab that has the 'index' property.
console.log((<Tab>this.navCtrl).index);
I think this is a bit hacky, so I'm glad to see other answers. But for now, you can try the following :)
Source: https://habr.com/ru/post/1658529/More articles:How to organize an Event Sourcing event handler to build a reading model? - cqrsHow to decrease and increase the value of a text field? - javascriptModule not found: Error: cannot resolve '@ angular / core' - angularcan change the name of a webpage over and over again - javascriptWhat is the average_loss field in a caffe solver? - caffeSSDT & TFS: SQL Server database comparison not working - sql-serverPublishing SSDT script recreates procedures without changes - visual-studio-2015What makes Pythons add a list method quickly? - performanceAngular 2 File Download? - angularInclude only one property, not an entire database row. - c #All Articles