您好我有以下路线结构:
export const routes: Routes = [
{
path: 'site', component: MainViewComponent, pathMatch: 'full',
children: [
{ path: '', redirectTo: 'extra-details', pathMatch: 'full'},
{ path: 'extra-details', component: ExtraDetailsViewComponent}
]},
{ path: 'login', component: LoginViewComponent, pathMatch: 'full' },
{ path: '**', component: PageNotFoundComponent }
];
登录和404(找不到页面)都很有效,问题是当我尝试访问/ site时,它被重定向到/ site / extra-details,但它显示404视图。当我评论' **'路径我收到以下错误:
错误:无法匹配任何路线。网址细分:'网站/额外细节'
我错过了什么?
谢谢, 马坦
答案 0 :(得分:2)
pathMatch
,在已定义组件的位置删除它。