I'm new to Angular, and trying to configure routes. I have routes defined in a FeatureModule, and the feature module is loaded by selector into the app.
My understanding is that an empty path '' will result in the specified component being rendered in its parent's router-outlet. However, that's not what seems to be happening.
Please refer to this Stackblitz demo of the issue: Routing Issue Live Demo
The routes in my FeatureModule are defined as:
const routes: Routes = [
{
path: '',
component: HomeComponent,
children: [
{
path: '',
component: ChildComponent
}
]}
];
HomeComponent ("feature home works!") is rendered correctly. I expected ChildComponent to be rendered in HomeComponent's router-outlet, but it is not.
I have added some text above the router outlet to make it easy to visualize where I expect ChildComponent to be rendered:
[feature child should be rendered here]
<router-outlet></router-outlet>
Can someone help me understand why ChildComponent is not rendering?
Thanks!
(P.S. I have added some divs and CSS to the components and router-outlets in Stackblitz to better visualize them).