0

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?

2
  • 1
    Personally, 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. Commented Feb 22, 2016 at 7:57
  • Instead of that, why you don't use back button which always go to redirected states Commented Feb 22, 2016 at 8:08

1 Answer 1

-1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your kind reply, that solves my problem!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.