angular.js - ui-router怎么删除某个历史记录?
某草草
某草草 2017-05-15 17:07:29
0
1
963

1、我有三个页面路由:list、group、add,路由规则是这样的:点击list进入group,点击group进入add,在页面add点返回时返回到group,在add中点“保存”按钮后要跳到group,但是这时在group中如果点返回它又跳到add页面,我要的是跳到list页面,相当于如果是点“保存”按钮的话我想把add这个历史记录删除,我改怎么做?

某草草
某草草

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