Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding routes on url Angular 2+

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!

like image 274
Mauro Cappelloni Avatar asked Mar 21 '18 13:03

Mauro Cappelloni


1 Answers

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 });
like image 158
Narm Avatar answered Sep 28 '22 06:09

Narm