Reputation: 6857
The following router configuration gives me an error:
const appRoutes: Routes = [
{
path: 'group/:groupID',
component: ExampleComponent1,
children: [
{ path: 'grid/:gridID', component: ExampleComponent2 },
]
}
];
Results in:
Error: Cannot find primary outlet to load 'ExampleComponent1'
But if I comment out the line component: ExampleComponent1,
, then it works fine.
Shouldn't I be able to specify a component that displays when the grid parameter is omitted? How can I do that?
Upvotes: 0
Views: 65
Reputation: 14574
ExampleComponent1 needs to include a Router Outlet.
Somewhere in that component's template, you need to include a <router-outlet></router-outlet>
tag. This tag is the marking point for where your ExampleComponent2 will be inserted into ExampleComponent1 when you navigate to that URL.
Upvotes: 1