在 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屋!
查看全文