【发布时间】:2020-07-24 23:53:55
【问题描述】:
我的 app.routing.module.ts 中有以下设置。
app.component.html
<router-outlet></router-outlet>
modules/core/components/home/home.component.html
<mat-sidenav-container autosize>
<mat-sidenav #sidenav role="navigation">
<!--this is a place for us to add side-nav code-->
<wn-sidenav-list (sidenavClose)="sidenav.close()"></wn-sidenav-list>
</mat-sidenav>
<mat-sidenav-content>
<!--in here all the content must reside. We will add a navigation header as well-->
<wn-header (sidenavToggle)="sidenav.toggle()"></wn-header>
<main>
<!-- I want the components child components of the home components to be loaded here -->
<router-outlet></router-outlet>
</main>
<wn-footer></wn-footer>
</mat-sidenav-content>
问题
当我访问 localhost:4200/campaigns 或 localhost:4200/dashboard 时,会显示它们各自的组件,但它们没有使用其父级 (home.component.html) 视图
我的目标
我希望home组件的所有子组件都显示在home.component.html的router-outlet,其他组件显示在router-outlet app.component.html
我之前有过这样的设置,但当时我没有使用模块,它运行良好。延迟加载有什么我不明白的地方吗?
【问题讨论】:
标签: javascript angular typescript ecmascript-6 single-page-application