Ionic button and tab button to be connected together


#1

Hi, I have a code and would need help as I am very new to Ionic. After follows guides on the forum, no luck in solving.

I have done up the tab bar.

My problem is, for example, I have a home page which contains a button that can be navigate to page 2 upon clicking it. Similarily, on the tab bar, I can click on the tab icon to navigate to page 2. However, both the button and tab do not link (highlighted). I need help real bad.

P.S. I am using lazy loading.

Thank you in advance.


#2

Please share the screenshot so that I can visualize your requirement.

Now my understanding is, when you click the button and go to next tab means, in that time, the selected tab is not highlighting. Is this the thing you want to convey?

If yes, follow the below instruction and check whether it is working.

For button click event,

use
this.navCtrl.parent.select(1); //Here 1 refers to the index number of the tab, which means Index number of tab1 is 0, tab2 is 1, tab3 is 2 and so on.

Hope this should work


#3

YES! Thank you so much. How does this work?


#4

In your app, your tabs will be the rootpage, and each tab items will have tab index. If we go by tab index, then the tab changes will reflect. Else, you can only able to get the page data, but no change in the tabs


#6

Hi, apparently, if I would need to use popupcontroller to push me to another page. However, when I got push to another page, the tabs is missing.


#7

Can you please share your code?