Hiding url path in angular
I am building a route in angular as show below:
const routes: Routes = [
{path:'home', component: HomeComponent},
{path:'', redirectTo: 'home', pathMatch: 'full'},
{path:'**', redirectTo: 'home', pathMatch: 'full'}
];
But when I open the webpage like http://localhost:4200/, it redirects to http://localhost:4200/home, which is the expected behavior, but I want to hide the /home at the end. Please dont be limited to this example only, this is only a simple scenario. Is there any way to do it.
Thanks
yes, of course. In your code, if you navigate to a particular component, you can then use this:
this.router.navigate(['/planning/capplanning'], {
skipLocationChange: true,
});