On my login page I am using this.nav.setRoot(TabsPage);
to navigate to the 'main app'. However, this makes the first tab the default page. On the other hand, if i use this.nav.setRoot(HomePage)
; I get the correct page but am missing the tabs. How do I set the default tab on page switch?
All tabs can be changed by setting the value of tabsLayout on the <ion-tabs> element, or in your app's config. For example, this is useful if you want to show tabs with a title only on Android, but show icons and a title for iOS.
Simple tabs menu can be created by using <ion-tabs> and <ion-tab-bar> component.
Adding Tabs Bar in Ionic Application The tab navigation is created by adding the ion-tabs having ion-tab-bar inside it which creates a tab bar on position defined in the slot property. Each tab button is created using the ion-tab-button with tab property which is the path of tab page resulting navigation.
Answer. Answer: Tabs Directives First, the main directive that wraps everything related to the tabbed interface.
After further googling, I found the solution in the ionic2 documents. If anyone else in the future is wondering the same thing, the solution is to add selectedIndex="X"
to the <ion-tabs>
tag. (http://ionicframework.com/docs/v2/api/components/tabs/Tabs/)
UPDATE for clarity: your code will look like this for selecting the 3rd tab:
<ion-tabs selectedIndex="2">
and like this fore selecting the 2nd tab:
<ion-tabs selectedIndex="1">
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