I have an index page in Angular 4 and after the login, I want to replace the old page content or at least redirect it to the dashboard. On the index page there is something like about us and in the dashboard there is custom.
I already tried I think every thing on the internet like:
{ path: '', redirect To: '/dashboard', path Match: 'full' }
defaulter
I don't think you can "replace" the root selector. Rather you can change it to only contain a router outlet:
app.component.html
<router-outlet></router-outlet>
Then anything you route to this router outlet can use the full page and replace any menu/navigation components.
You can then have something like a shell component that has the desired menu.
shell.component.html
<mh-menu></mh-menu>
<div class='container'>
<router-outlet></router-outlet>
</div>
You could then replace this shell component with any other component with its own menu.
I have an example here: https://github.com/DeborahK/MovieHunter-routing
Here is a picture showing the app's router outlet and a shell component's router outlet: