小编A_D*_*A_D的帖子

如何使用相对导航导航到 Angular 4 中的同级?

我面临着延迟加载的路由器导航问题。如果有人澄清下面的问题,我将不胜感激。谢谢。

app-routing.module

const routes: Routes = [
{ path: 'home', component: HomeComponent},
{ path: Details, loadChildren: 'pathToDetailsModule'}
];
Run Code Online (Sandbox Code Playgroud)

details.module.ts

const routes: Routes = [
{
  path: '', component : DetailsComponent,
   childern : [
    {path: '' , redirectTo: prodType},
    {path: prodType , loadChildren: pathtoModuleProd},
    {path: CusDetails, loadChildren: pathtoModuleCustomer},
    {path: EmpDetails, loadChildren: pathToModuleEmp}
   ]
},
];
Run Code Online (Sandbox Code Playgroud)

最初,当我单击 Details (app-routing.module) 时,DetailsModule 会默认获取 load 和 DetailsComponent 并重定向到 prodType。我的页面显示 ProdType(child)。现在我想导航到 CusDetails。

问题:

#1.

这一点

currentRoute =  this.activatedRoute.snapshot.url[0].path
Run Code Online (Sandbox Code Playgroud)

正在给出结果Details(父母)而不是prodType(孩子)。延迟加载模块是否添加了空路径?现在我在孩子上 -prodType并且想要导航到孩子 …

lazy-loading angular angular4-router

1
推荐指数
1
解决办法
3991
查看次数

标签 统计

angular ×1

angular4-router ×1

lazy-loading ×1