本文介绍了Angular 2路由-隐藏URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道您可以使用 this.router.navigate([ / Pages],{skipLocationChange:true});
进行路由时隐藏URL。使用 window.open( / Pages)
它具有URL。
I know that you can hide the URL when routing using this.router.navigate(["/Pages"], { skipLocationChange: true });
but when i use window.open("/Pages")
it has the URL.
有什么方法可以隐藏使用 window.open()
或使用angular2路由器在新标签页中打开URL时的URL?
Is there any way to hide the URL when using window.open()
or a way to use the angular2 router to open the URL in a new tab?
推荐答案
最后找到了一种简单的方法。 history.pushState({}, Edit, http:// localhost:4200 /);
对于之后的工作正常。
Found an easy way in the end. history.pushState({},"Edit","http://localhost:4200/");
works fine for what im after.
这篇关于Angular 2路由-隐藏URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!