在url Angular 2+上隐藏路线 [英] Hiding routes on url Angular 2+
本文介绍了在url Angular 2+上隐藏路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因此,我试图在url上隐藏我的路线,这意味着我希望我的应用程序始终在根应用程序中显示该url,例如:
So I am trying to hide my routes on the url, that means i want my app to show always the url as being in the root app, for example:
"www.foo.com"
"www.foo.com"
代替
"www.foo.com/login"
"www.foo.com/login"
有什么方法可以在角度2中做到这一点吗?
Its there any way to achieve this in angular 2?
提前感谢您的帮助!
推荐答案
您正在寻找的是Angulars skipLocationChange
,这就是Angular所称的"NavigationExtras".以下是文档:有关NavExtras的Angular文档
What you are looking for is Angulars skipLocationChange
, this is what Angular refers to as "NavigationExtras". Here is the documentation: Angular docs on NavExtras
// Navigate silently to /view
this.router.navigate(['/view'], { skipLocationChange: true });
这篇关于在url Angular 2+上隐藏路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文