I have two pages, index.html and tabs.html. tabs.html is a nested structure, it has a tabs component and every tab is bind to a state(tab1, tab2, tab3). When changing from index.html to tabs.html, the state change path will be: index -> tabs -> tab1. When you click other tabs, the state change path maybe: index -> tabs -> tab1 -> tab2. Now if you click the back button of the browser, you will just go back from tab2 to tab1, that means you are still in tabs.html. Now my question is, is there any good method to realize when clicking the back button of browser, I can go back to index.html not just the previous state?
-
1Personally, I don't like sites where you directly fall back too much by clicking the back button... I like to be where I've been before the last click.Raphael Müller– Raphael Müller2016-02-22 07:57:29 +00:00Commented Feb 22, 2016 at 7:57
-
Instead of that, why you don't use back button which always go to redirected statesojus kulkarni– ojus kulkarni2016-02-22 08:08:37 +00:00Commented Feb 22, 2016 at 8:08
Add a comment
|
1 Answer
Because back operation in browser works with URLs, you can remove url property in state definition for tab1, tab2 and tab3 states, and you have to link them just with ui-sref.
Now if you back in browser you will go to index.html
1 Comment
ahwyX100
Thanks for your kind reply, that solves my problem!!