How to make a named routing outlet work with loadChildren?

前端 未结 2 1283
梦谈多话
梦谈多话 2021-02-05 04:48

I\'ve created two plunkers concerning an issue with routing\'s loadChildren and outlet navigation. For some reason, having an empty base path within the loaded child module does

2条回答
  •  半阙折子戏
    2021-02-05 05:39

    Solution below will work for how many outlets you want. You can have same thing in second.component.ts.

    first.module.ts

    const routerConfig: Routes = [
        {path: '', component: FirstComponent},
    
        {
            path: 'posts', component: FirstComponent, children: [{
                path: '',
                loadChildren: './second.module#SecondModule'
            }]
        }
    }
    

    first.component.html

    // ....
    
    // ....
    

提交回复
热议问题