Navigate between super-tabs with buttons


#1

Hello,
supertabs version : “ionic2-super-tabs”: “^4.2.2”,

I want to navigate between all of tabs with buttons. So I created my tabs.
I work with ionic 3

HomePage.ts :

  pages = [
    { pageName: 'Page1Page', id: 'page1Tab'},
    { pageName: 'Page2Page', id: 'page2Tab'},
    { pageName: 'Page3Page', id: 'page2Tab'},

  ];

  @ViewChild(SuperTabs) superTabs: SuperTabs;

HomePage.html :

<super-tabs tabsPlacement="top" toolbarBackground="secondary" toolbarColor="light" indicatorColor="light">
    <super-tab *ngFor="let page of pages" [root]="page.pageName" [id]="page.id"></super-tab>
  </super-tabs>

And if I am in the second page, i did a button :

<button ion-button (click)="goToPage1()" > Page1</button>

and my page2.ts

slideToPage1() {
    this.superTabs.slideTo();
  }

But I have this error:

ERROR TypeError: Cannot read property ‘slideTo’ of undefined
at TestPage.webpackJsonp.293.TestPage.slideToIndex (test.ts:38)
at Object.eval [as handleEvent] (TestPage.html:9)
at handleEvent (core.js:13547)
at callWithDebugContext (core.js:15056)
at Object.debugHandleEvent [as handleEvent] (core.js:14643)
at dispatchEvent (core.js:9962)
at core.js:10587
at HTMLButtonElement. (platform-browser.js:2628)
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.js:4740)

Can you help me ?
Thank in advance