Redirect on startup->problem with history

Hey guys,

I’ve got an app with multiple tabs. In my main tab there are 3 views, call them A,B and C.
The user navigates exactly in this order with the option to go back only on view B. The user should not have a possibility to leave view C without pressing one single button (which returns him to view B). This is all working perfectly.

But when the user closes the app, he have to get redirected to view C if this is the view he have been on when leaving the app (for e.g. rebooting). I included another view at the startup to check if a certain variable is checked and redirect to view C based on this variable.

Now I’m stuck: i can’t go back from view C to view B because the views A and B are not in the history. If I change the view using $state.go, the history is also not what the user would expect (pressing back on view B bringing him to view A, not, as it is the case, to view C). I hope I described the problem acurate and somebody from you guys have a hint for me on what to try next.

Any help’s appreciated.

cheers, charlie

I get the problem you’re trying to solve. I recently put up and article which deals with your problem, although it’s talking about deep linking. The theory behind the solution should solve your problem. Check it out and if it’s still confusing I’ll see if I can help out further.

Thank you so much, with some minor modifications it works like a charm.
One last question though: is there an easy way to map this behavior to the android back-button?

1 Like