This is a follow up question to this: Angular 2 how does auxiliary routes work in 2.1.0?
I also tried looking at this but it doesn't really shed any light on the issue: How to render the child route into the router-outlet of the parent`s parent
If I have a parent route /admin
which has a <router-outlet name="admin"></router-outlet>
which looks like this:
const routes: Routes = [
{
path: '',
component: AdminAreaComponent,
canActivate: [AuthGuardService]
},
{
path: 'login',
loadChildren: '../pages/+login/login.module#LoginModule',
outlet: 'admin'
},
{
path: 'dashboard',
loadChildren: '../pages/+dashboard/dashboard.module#DashboardModule',
outlet: 'admin'
}
];
I would access the dashboard via /admin(admin:dashboard)
, but now I need to render a child view of dashboard
into the same router-outlet
as the dashboard, which is admin
. That view looks like this:
const routes: Routes = [
{
path: '',
component: DashboardComponent
},
{
path: 'brands',
loadChildren: '../pages/+brands/brands.module#BrandsModule',
outlet: 'admin'
}
];
However, when I try to access this route via /admin(admin:dashboard/brands)
I get an error:
Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'admin'
I'm guessing that I'm doing something wrong in the route config.
How can I fix this?