angular - Angular6:延迟加载时的引导模块组件
问题描述
解释
我有一个辅助模块,它为内部模块提供共享逻辑/视图(为简单起见,在此示例中添加了页脚)。
结构如下:
- 应用程序模块
- 容器模块
- inner1.module
- inner2.module
- 容器模块
在app.routing
中,模块app
延迟加载到container
模块,如下所示:
{
path: 'inner1',
loadChildren: 'app/container/container.module#ContainerModule'
},
{
path: 'inner2',
loadChildren: 'app/container/container.module#ContainerModule'
},
虽然container.routing.ts
选择正确的组件:
{
path: 'inner1',
component: Inner1Component,
},
{
path: 'inner2',
component: Inner2Component,
}
并container.module
引导它自己的组件:
bootstrap: [
ContainerComponent
]
哪里container.component.html
有一个router-outlet
和一个页脚:
<router-outlet></router-outlet>
<footer>
// Stuff here
</footer>
现在 的问题
当路线是inner1
,container.component
永远不会真正激活并且页脚永远不会显示。似乎router-outlet
的app.component.html
正在直接显示 的内容inner1.component.html
。
客观的
app.module
router 在其出口中显示container.component
内容,路由器在其出口中container.module
显示。inner1.component
container.component
如何做到这一点?
解决方案
推荐阅读
- jquery - 使用 jQuery 如何为页面中的所有 ahrefs 创建唯一 id
- git - 瓷器命令添加和提交中使用了哪些管道命令?
- python - 如何计算在字符串中找到的三元组的数量?
- reactjs - 由于缺少 CSRF 令牌,Django Rest 框架中的发布请求失败
- node.js - Kubernetes ECONNRESET nodejs
- data-visualization - Tableau 如何根据两个字段为图表着色,一个是连续的,另一个是离散的
- unity3d - unity调整大小布局
- python - 如果出现任何错误,Excel.exe 进程将继续运行
- xquery - Marklogic 提交帧/返回序列保证
- c++ - 应该使用什么类型的 C++ 类型转换来将指向结构的指针转换为它的第一个成员?