我的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 的路由器出口中,而其他组件将显示在home的 router-outlet中。 app.component.html
我以前有这样的设置,但是当时我没有使用模块,它运行良好。关于延迟加载,我不了解吗?
答案 0 :(得分:0)
当我访问localhost:4200 / campaigns或localhost:4200 / dashboard时, 显示了广告系列模块的组件,但未使用 他们父母的(home.component.html)视图
在路线配置中,您使用的是redirectTo:'/dashboard'
,因此,您将看到广告系列的视图