Angular 子路由路由参数

问题描述 投票:0回答:1

我有一个网址,例如 http://localhost:4200/analysis/portugal/lisbon/demography/population/2022 我创建了路线路径,但出现错误。我的错误在哪里?

main.ts:6错误错误:未捕获(承诺):错误:NG04002:无法 匹配任何路线。网址段: “分析/葡萄牙/里斯本/人口统计/人口/2022”错误:NG04002:无法匹配 任何路线。 URL 段:'analysis/portugal/lisbon/demography/population/2022

{
    path: 'analyse', component: AnalyseComponent, canActivate: [AuthGuard], children: [
        {
            path: 'portugal/:province/demography', component: DemographyComponent, children: [
                {path: '', redirectTo: 'population', pathMatch: 'full'},
                {path: 'population/:year', component: PopulationComponent},
                {path: 'age/:year', component: AgeComponent},
            ]
        },
}
angular routes
1个回答
0
投票
{
    path: 'analyse', component: AnalyseComponent, canActivate: [AuthGuard], children: [
    {
        path: 'portugal/:province/demography', component: DemographyComponent, children: [
            {path: '', redirectTo: 'population', pathMatch: 'full'},
            {path: 'population/:year', component: PopulationComponent},
            {path: 'age/:year', component: AgeComponent},
        ]
    },
}

网址将像这样“http://localhost:4200/analysis/portugal/lisbon/demography/population/2022”

© www.soinside.com 2019 - 2024. All rights reserved.