I am lazy loading few modules in my Angular 4 app, with child routes to the lazy loaded module, but I am getting an error as Error: Cannot match any routes. URL Segment: 'order-management/list-view' when accessing the route.
Here's my main app routing code:
{path: 'login', component: LoginComponent}, {path: 'order-management', loadChildren: './order-management/order-management.module#OrderManagementModule'}, {path: '', redirectTo: '/login', pathMatch: 'full'} and here's the routing code for the lazy loaded OrderManagementModule:
{path: '', component: OrderManagementComponent, pathMatch: 'full', children: [ {path: 'list-view', component: ListComponent}, {path: 'column-view', component: ColumnComponent}, {path: 'comfy-view', component: ComfyComponent}, {path: '', redirectTo: '/order-management/list-view', pathMatch: 'full'}, ]} Assume the code to load each child component in the path /order-management/SOME_CHILD_COMPONENT and also redirect /order-management path to /order-management/list-view. I am not sure, what went wrong here. Please solve this issue.
pathMatch: 'full'from theOrderManagementComponentpath. Also set theredirectTotolist-viewpathMatch: 'full'is causing the issue.