I'm using nested routes in my Angular 4 application. They are structured as follows:
routes = [
{
path: 'parent',
component: ParentComponent,
children: [
{
path: 'child',
component: ChildComponent,
children: [
path: 'grandchild',
component: GrandchildComponent
]
}
]
}
]
I have a single router outlet defined in app.component.html.
When I navigate to the 'parent/child' route, this setup works fine, with the router outlet loading the ChildComponent.
However, when I navigate to the 'parent/child/grandchild' route, the GrandchildComponent doesn't load.
This does seem to work with a secondary router outlet in the child component, but is there any way that I could get the GrandchildComponent to load on the root router outlet, without the need for a secondary one?
[{path: 'parent/child/grandchild', component: GrandchildComponent}]
, but as others have said it is not really a grandchild at this point so it is probably mislabeled. – LLai