简体   繁体   English

角路由不适用于制表符

[英]Angular routing not working with tabs

I am using tab navigation for my profile page. 我在个人资料页面上使用标签导航。 The profile page holds the tab control. 配置文件页面包含选项卡控件。 The problem occurs when the first tab equals to the root domain url the tab control does not navigate anymore when clickin the tabs. 当第一个选项卡等于根域URL时,单击选项卡时该选项卡控件不再导航,就会出现问题。

Here is a plunkr demonstrating the problem: 这是一个展示问题的小插曲:

https://plnkr.co/edit/emIJSNkxPuDxCjPSbXJy?p=preview https://plnkr.co/edit/emIJSNkxPuDxCjPSbXJy?p=preview

Maybe I am missing something but this could be bug in angular routing. 也许我错过了一些东西,但这可能是角度布线中的错误。

Is it possible to configure routing like this? 是否可以像这样配置路由?

Here is the code for the tab routes 这是标签路线的代码

const ROUTES: Routes = [
    {
        path: '', component: ProfileComponent,
        children: [
            { path: '', loadChildren: 'src/user/subModule1/subModule1.module#SubModule1Module'},
            { path: 'subPath2', loadChildren: 'src/user/subModule2/subModule2.module#SubModule2Module' },
        ]
    }
];

If I understood correctly you want routing in your profile page which is on 'user/:id' route. 如果我理解正确,则希望在“用户/:id”路由上的个人资料页面中进行路由。 Then root would be like 那么root就像

const ROUTES: Routes = [
{
    path: 'user', component: ProfileComponent,
    children: [
        { path: '', loadChildren: 'src/user/subModule1/subModule1.module#SubModule1Module'},
        { path: 'subPath2', loadChildren: 'src/user/subModule2/subModule2.module#SubModule2Module' },
    ]
}

]; ]。

Then when you load /user SubModule1 would be lazy loaded and on /user/subPath2 SubModule2 would be lazy loaded 然后,当您加载/ user时,SubModule1将被延迟加载,而在/ user / subPath2上,SubModule2将被延迟加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM