【发布时间】:2018-09-10 21:34:21
【问题描述】:
我的应用层次结构如下:
- 应用程序(根)
- 模块(模块)
- 大师
- 详情
- 导航
- 创建/主页(组件)
- 字段(模块)
- 详细信息(组件)
- 主(组件)
- 模块(模块)
modules-routing.module.ts
const routes: Routes = [
{ path: 'modules-detail/:module_name', loadChildren: './module-detail/module-detail.module#ModuleDetailModule' },
{ path: '', component: ModulesMasterComponent }
];
modules-detail-routing.module.ts
const routes: Routes = [
{
path: '',
component: ModulesNavComponent,
children: [
{ path: '', component: CreateModuleComponent },
{ path: 'new', component: CreateModuleComponent },
{ path: 'fields', loadChildren: './fields/fields.module#FieldsModule' }
]
}
];
fields-routing.module.ts
const routes: Routes = [
{
path: '',
component: FieldsMasterComponent
},
{
path: ':field_id',
component: FieldDetailComponent
}
];
问题
当我重定向到 /modules/testModuleName/fields 时,我试图访问在 modules-routing.module (testModuleName) 中声明的 module_name 参数。
但是,当我在字段模块中时,我的路由参数为空。
我可以在 create/home 组件中看到参数,但在子模块中看不到。任何帮助将不胜感激!
【问题讨论】:
标签: angular angular6 angular-routing ng-modules