AngularJS redirect without pushing a history state

后端 未结 2 1121
北海茫月
北海茫月 2020-12-14 06:14

I\'m working on an AngularJS app that has a catch all route (eg, .when(\'/:slug\', {...)) which is necessary to support legacy url formats from a previous (non-

2条回答
  •  自闭症患者
    2020-12-14 06:51

    You can change the url without adding to the history state, found here under "Replace Method". This is effectively the same as calling HTML5's history.replaceState().

    $location.path('/someNewPath').replace();
    

    I haven't found that it's possible to change the view without changing the url. The only method to change the view, that I've found, is to change the location path.

提交回复
热议问题