# Bug in jumping between tabs page?

**URL:** <https://forum.ionicframework.com/t/bug-in-jumping-between-tabs-page/101606>\
**Category:** ionic-v3\
**Created:** [August 10, 2017, 8:37pm UTC](https://forum.ionicframework.com/t/bug-in-jumping-between-tabs-page/101606 "2017-08-10T20:37:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielle123](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@danielle123](https://forum.ionicframework.com/u/danielle123)\
**Post date:** [August 10, 2017, 8:37pm UTC](https://forum.ionicframework.com/t/bug-in-jumping-between-tabs-page/101606/1 "2017-08-10T20:37:45Z")

</div>

Hi,

I have a `TabsPage` with 4 individual tab pages inside.  
In “Feedback” tab page, I want to jump to “Home” tab page when a `submit` (send!) button is clicked.

**This is the feedback page content**

 ![IMG_0532](https://global.discourse-cdn.com/ionicframework/original/3X/f/1/f1af36b581400ffb098c0c45b21f29119b6a10ef.PNG)

**After clicking “Send!” (submit) button, the screen displays homepage content while tab highlight is wrong in “Feedback” - screenshot below**  
**Only by clicking twice the “Feedback” tab on the bottom, the screen will display content correctly.**

 ![IMG_0531](https://global.discourse-cdn.com/ionicframework/original/3X/8/3/833d33ee74eafab5be2f33016b23b37682e3e538.PNG)

Did I make anything wrong in the code?

TabsPage html file

```auto
<ion-tabs [selectedIndex]="tabIndex">
  <ion-tab [root]="tab1Root" tabTitle="Home" tabIcon="home"></ion-tab>
  <ion-tab [root]="tab2Root" tabTitle="Timeline" tabIcon="information-circle"></ion-tab>
  <ion-tab [root]="tab3Root" tabTitle="Feedback" tabIcon="contacts"></ion-tab>
  <ion-tab [root]="tab4Root" tabTitle="My" tabIcon="settings"></ion-tab>
</ion-tabs>

```

TabsPage ts file

```auto
  tabIndex: number = 0;

  constructor(public navParams: NavParams, public utilProvider: UtilProvider) {
    this.tabIndex = navParams.get("openTab") || 0;
  }

```

Feedback page ts file

```auto
submit() {
 this.navCtrl.setRoot("TabsPage", {
            openTab: 0
          });
}

```

---

<div class="post-metadata">

**Author:** ![rdlabo](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rdlabo/32/99539_2.png) [@rdlabo](https://forum.ionicframework.com/u/rdlabo)\
**Post date:** [August 10, 2017, 9:15pm UTC](https://forum.ionicframework.com/t/bug-in-jumping-between-tabs-page/101606/2 "2017-08-10T21:15:28Z")

</div>

You should look at document([https://ionicframework.com/docs/api/components/tabs/Tabs/](https://ionicframework.com/docs/api/components/tabs/Tabs/))  
The correct sample code is introduced in the document.

---

<div class="post-metadata">

**Author:** ![danielle123](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@danielle123](https://forum.ionicframework.com/u/danielle123)\
**Post date:** [August 11, 2017, 8:03am UTC](https://forum.ionicframework.com/t/bug-in-jumping-between-tabs-page/101606/3 "2017-08-11T08:03:33Z")

</div>

Though I think I followed there, I will take a more close look.

Would you mind to tell anything wrong that you see from my code?

---

<div class="post-metadata">

**Author:** ![rdlabo](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rdlabo/32/99539_2.png) [@rdlabo](https://forum.ionicframework.com/u/rdlabo)\
**Post date:** [August 11, 2017, 8:21am UTC](https://forum.ionicframework.com/t/bug-in-jumping-between-tabs-page/101606/4 "2017-08-11T08:21:50Z")

</div>

As a point to think about at once.

1. constructor is not ionic lifecycle.
2. document not suggest binding method. use `@ViewChild('myTabs') tabRef: Tabs;`.
3. if control tab page, you can use `this.navCtrl.parent.select(2);`.

Document tell you correct writing style.  
regard.

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 11, 2017, 1:55pm UTC](https://forum.ionicframework.com/t/bug-in-jumping-between-tabs-page/101606/5 "2017-08-11T13:55:35Z")

</div>

> [@danielle123](#):
>
> this.tabIndex = navParams.get(“openTab”) || 0;

Add a `console.log` before this line when (and how often) this is actually executed.

---

<div class="post-metadata">

**Author:** ![danielle123](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@danielle123](https://forum.ionicframework.com/u/danielle123)\
**Post date:** [August 11, 2017, 7:41pm UTC](https://forum.ionicframework.com/t/bug-in-jumping-between-tabs-page/101606/6 "2017-08-11T19:41:24Z")

</div>

I eventually used `this.navCtrl.parent.select(0)`, it works!

`this.navCtrl.setRoot` does call the constructor on the `TabsPage` as I tested, but the bug persists  
`@ViewChild('myTabs') tabRef: Tabs` cause the app freezes at a blank page in launching
