[solved] How to trigger a tab click? (outside of the tabs)


#1

I’ve started with the ionic tabs starter app and I’m modifying it from there.
My testing app is so simple I don’t even want the tabs but I figure the states can be good to keep so I figured I could just hide the tabs (works fine with the class “tabs-item-hide”).

But now I want to trigger one of the tab states with a big full width button - how can I do this? And where in the file structure should I write this?

Thanks!


#2

You can navigate between tab states using the state provider as your routing service. I created a codepen for you. I took this then hid the tab items, then added buttons showing how to go to different tabs without the tab items themselves.


#3

Thanks a lot MrOnosa!
The a href link worked great. But I’m using the button element.

<button class="button button-full button-calm button icon-right ion-chevron-right">

Can you help me make that have the same effect?


#4

Sure. I updated the code pen. Note the logic in the HomeTabCtrl. By the way, one can typically style an anchor tag to look like a button if you wanted.


#5

Super thank you! That worked like a charm :smile: