angular - Angular 8:在根组件中使用模板延迟加载
问题描述
我有 pages-routing.module.ts 有这样的子路由:
const routes: Routes = [
{
path: '',
component: PagesComponent,
children: [
{
path: 'persons',
loadChildren: './persons/persons.module#PersonsModule'
}
]
}
]
在我的persons-routing.module.ts中,我的孩子溃败无法正常工作
我的个人路由,.module.ts 是:
const routes: Routes = [
{
path: '',
component: PersonsComponent,
children: [
{
path: 'Test',
component: TestComponent
},
{
path: 'Sample',
component: SampleComponent
},
{
path: '',
redirectTo: 'Sample',
pathMatch: 'full'
}
]
}
]
@NgModule({
declarations: [],
imports: [
CommonModule,
RouterModule.forChild(routes)
],
exports: [
RouterModule
]
})
当我路由到人员时,我想在我的 PersonsComponent 中的基本模板旁边打开“SampleComponent”
<div class="row ml-0">
<div class="col-xs-12 col-sm-6 col-md-5 col-lg-2 p-0 person-sidebar">
<nb-card size="small" class="mb-0">
</nb-card>
</div>
<div class="col-xs-12 col-sm-6 col-md-7 col-lg-10 pl-0" *ngIf="selectedUser">
<router-outlet></router-outlet>
</div>
</div>
如何解决问题?
解决方案
推荐阅读
- react-native - 为什么 Navigation.goBack() 无法正常工作?
- swiftui - SwiftUI 中的多个 NavigationLink
- node.js - 从一组非静态文件中加载命令的安全方法是什么?
- c# - 如何在使用 DataTriggers 为 ListViewItems 选择模板的 ListView 中重新绘制单个项目?
- c - epoll 是否仍然比阻塞监听 HTTP 1.0 更有效?
- java - 使用 Java 对越南语文本进行排序时,“Đ”排序不正确
- r - R问题中的正则表达式:无法突破价格
- php - 类似于 W3Schools 的图像上传的 PHP 问题
- php - 如何在 PHP DOMDocument 中附加具有空属性的 XML(片段)
- php - 从 profile.php 页面发送带有 wp_mail 的电子邮件