In my Angular-6 project, I want a nested route to be the default route. That means if the user hits "localhost:4200" in browser he'll be redirected to "localhost:4200/dashboard/headlines". I wrote below route configuration, but it is not working. 1. what am I doing wrong? 2. Is it possible to implement the same for lazy loading module?
const routes: Routes = [
{
path: '',
redirectTo: '/dashboard',
pathMatch: 'full'
},
{
path: 'dashboard',
component: NewsComponent,
children: [
{ path: '', redirectTo: '/headlines', pathMatch: 'full' },
{ path: 'headlines', component: HeadLinesComponent },
{ path: 'detail', component: DeatilNewsComponent }
]
}
]
news.component.html
<div>News Work</div>
<router-outlet></router-outlet>
app.component.html
<router-outlet></router-outlet>