AngularJS:如何从的window.history删除当前视图网址是什么? [英] AngularJS: How to remove current view url from window.history?
本文介绍了AngularJS:如何从的window.history删除当前视图网址是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我#/加载数据
观点与微调。当数据加载完成控制器重定向到differen视图 $ location.path('/显示-INFO /')
。
如何从历史记录中删除#/负载数据,以避免 window.history.back()
来#/加载数据的看法?
I have #/load-data
view with spinner. When data load is complete controller redirects to differen view $location.path('/show-info/')
.
How to remove #/load-data from history to avoid window.history.back()
to #/load-data view?
推荐答案
您可以使用 $ location.replace()
方法来替代过去的历史记录条目。
You could use the $location.replace()
method to replace the last history entry.
这里是链接到的文档。
所以,当你呈现微调,您可以通过下面的代码切换到实际的视图显示,信息
:
So when you are showing the spinner, you could switch to the actual view show-info
with the following lines:
$location.path('/show-info/');
$location.replace();
或较短的:
$location.path('/show-info/').replace();
这篇关于AngularJS:如何从的window.history删除当前视图网址是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文