Hiding routes on url Angular 2+

穿精又带淫゛_ 提交于 2020-01-02 07:45:17

问题


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"

instead of

"www.foo.com/login"

Its there any way to achieve this in angular 2?

Thanks in advance for the help!


回答1:


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 });


来源:https://stackoverflow.com/questions/49407520/hiding-routes-on-url-angular-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!