4

I have the following routes defined in my app.module :

RouterModule.forRoot([
{
  path: 'main',
  component: MainComponent,
  loadChildren: 'mySidebar.module#SidebarModule      
}
])

inside SidebarModule I define routes a:

RouterModule.forChild(
        [{
           path: 'sidebar1',
           component: SideBar1,
           outlet: sidebar
        },
        {
           path: 'sidebar2',
           component: SideBar2,
           outlet: sidebar
         }
       ])

and MainComponent is:

..
<router-outlet></router-outlet>
<router-outlet name="sidebar"><router-outlet>
..

when I navigate to 'main/(sidebar:sidebar1)', I get this error:

"cannot find outlet sidebar to load SideBar1"

which is probably caused by the fact that the child module does not know sidebar outlet. I want to populate sidebar with different child outlet (without exposing the specific component), is there a way to do so?

Yuvals
  • 3,094
  • 5
  • 32
  • 60

0 Answers0