Arj 1411
Arj 1411

Reputation: 1401

this.navCtrl.parent.select() is not working with super-tabs

I have implemented swipeable tabs in Ionic3 which works perfectly. I want to know how to select ContactPage from ChatsPage (both are individual tabs in super-tabs). this.navCtrl.parent.select(0) is not working with super-tabs.

    <super-tabs tabsHighlight="true" tabsPlacement="top" [selectedTabIndex]="mySelectedIndex" >
    <super-tab [root]="contactsRoot" title="My Team" ></super-tab>
    <super-tab [root]="chatsRoot" title="Chats" ></super-tab>
    <super-tab [root]="callsRoot" title="Call Log" ></super-tab>
</super-tabs>

Any idea on this?

Upvotes: 2

Views: 1219

Answers (1)

Arj 1411
Arj 1411

Reputation: 1401

Finally I got the solution from https://github.com/zyra/ionic2-super-tabs/issues/265#issuecomment-376225616

Solution

You need to inject SuperTabsController in our tab pages and from there call slideTo,

export class ChatsRootPage {
   constructor(private superTabs : SuperTabsController) {}

   goToContacts(){
      this.superTabs.slideTo(0, 'mainTabs'); // 0 is the index of contactsRoot tab and mainTabs is the id of your super-tabs component.
   }
}

Upvotes: 1

Related Questions