How would I set the active state of a tab based on my current route?
For example I have these routes:
/tabs
/tabs/list
/tabs/awesome
Then I have two tab buttons list on the left and Awesome on the right.
When I go to /tabs/awesome I want Awesome to be selected and I want to actually see the ‘Awesome’-state’s content.
Right now when I go to /tabs/awesome the content being rendered is empty (tries to resolve to /tabs/list)
Is this a bug or am I forgetting something?
@Robin Can you post a codepen? You should be able to just use ui-sref="tabs.awesome", but I’m having some difficulty trying to understand…(its still early in the morning for me )
Aint that the truth. I updated this codepen to demonstrate the “standard” way to set up tabs (or until it breaks later today). Like I said, I’m not sure where you’re having issues, so if you get the chance to post a codepen or something, let me know and I’ll take a look at it.
@mhartington You’re referencing ‘this codepen’ but I think you forgot the link.
My issue is when I’m opening the /tabs view, all is working fine and the first tab is opened and has an active state
From there on, when I click any of the tabs, everything is working as expected.
But I want to ‘deep link’ to a certain tab. In my example to /tabs/awesome, which is the second (and thus not the default) tab.
Straight from a non-tabbed view I want to link towards /tabs/awesome and have the Awesome tab opened and active. That’s not working now. The more I dig into this the more it seems like an Ionic issue…
Sorry about that, did I mention its still a bit early for me
From the main tab, you can navigate to some nested views then navigate to the second tab. You’re description makes a lot of sense, so my apologies for not quite understanding what you wanted.
Does the codepen reflect what you’re trying to accomplish?
tab.shown and tab.hidden have been killed. Although tab.shown is still working in some code bases and tab.hidden works one time only in some code bases.