angular.js - How to delete a historical record in ui-router?
某草草
某草草 2017-05-15 17:07:29
0
1
1087

1. I have three page routes: list, group, and add. The routing rules are as follows: click list to enter group, click group to enter add, return to group when returning to the page add point, and click "Save" in add. After clicking the button, you need to jump to the group, but if you click Return in the group, it will jump to the add page. What I want is to jump to the list page, which is equivalent to if I click the "Save" button, I want to delete the add history record. , what should I do instead?

某草草
某草草

reply all(1)
世界只因有你

History cannot be deleted, this is a browser thing.

You can use the $stateChangeStart event to control it. Refer to $stateChangeStart in this document to write it. The general idea is to use some method to retain whether add is saved. Then if the current route is group, the route to go to when clicking return is add. Then if the add is saved, prevent this event and go to the list. If it is not saved, jump normally

Or use a little trick, use window.history.go(-1) when clicking save, don’t use $state.go to jump

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template