Home > Software engineering >  Named router-outlet inside module - Path match but content doesn't load
Named router-outlet inside module - Path match but content doesn't load

Time:11-28

I have a lazy loaded module which includes named router-outlet (auxiliary routes). I'm not able to target content into this router. The path match and I can see it in the url but the content doesn't appear.

Here is a code example: Stackblitz

==== UPDATE

The code is fixed.

Usage:

  1. click on the "LOAD SUBMODULE" link
  2. submodule loads
  3. click on any lines above of "SUBMOD loaded" title.

CodePudding user response:

When you are using a router outlet inside a component the child routes needs be declared as children for the parent route.

This is how your submod routes should look like

{
  path: '',
  component: SubmodComponent,
  children: [
    { path: 'toloadin', outlet: 'suboutlet', component: ToLoadinComponent },
  ],
}
  • Related