错误:路由'{path:“teams /”,redirectTo:“all”}'的配置无效:请提供'pathMatch' . 'pathMatch'的默认值是'prefix',但通常意图使用'full' .
这是错误按摩 .
这是我在app.module.ts上的语法:
const routes = [
{ path: 'teams', component: TabsComponent, children: [
{ path: '', redirectTo: 'all', pathMacth: 'full' },
{ path: ':side', component: ListComponent }
] },
{ path: 'new-team', component: CreateTeamComponent },
{ path: '**', redirectTo: '/teams' }
] .
为什么我还有错误?
2 回答
重定向路由需要
pathMatch
属性来告诉路由器如何将URL与路径路径匹配 . 如果不这样做,路由器会抛出错误 .来自棱角分明docs
请尝试以下代码:
你有一个错字,你写的是 pathMacth 而不是 pathMatch