I am new to Angular. I am using Angular 7 and doing a simple routing.
After Login page, I want to display a home page. Login is a part of app-root
component and in
it should be like this in your dashboard-routing-module.ts:
const routes: Routes = [{
path: '',
component: DashBoardComponent,
children: [
{
path: '',
redirectTo: 'home',
pathMatch: 'prefix'
},
{
path: 'home',
component: HomeComponent
}
]
}];
you must use this code :
this._router.navigate(['/dashboard/home']);
if it doesn't work, in "dashboard-routing.modul.ts" file use path: ' ', instead of
path: 'dashboard',.