0
配置子路由後出現以下錯誤。如何正確配置子路由?錯誤:未捕獲(承諾):錯誤:無法匹配任何路由。 URL段:'parent/child1
錯誤:未捕獲(承諾):錯誤:無法匹配任何路由。 URL段:「父/ child1
app.routing.ts
{ path: 'home', component: homeComponent},
{ path: 'about', component: aboutComponent},
{ path: 'parent', component: parentComponent,
children:[
{
path: '',
redirectTo: '/parent/child1',
pathMatch: 'full'
},
{
path: 'child1',
component: child1Component,
outlet: 'subRouter'
},
{
path: 'child2',
component: child2Component,
outlet: 'subRouter'
}]
},
{ path: '**', redirectTo: 'home', pathMatch: 'full' }
在我的index.html,我有<router-outlet></router-outlet>
在我parent.htm(爲父級)我有<router-outlet name="subRouter"></router-outlet>
我錯過了什麼?爲什麼我得到那個錯誤?我該如何解決這個錯誤?
做出這個改變後,我得到了與URL段相同的錯誤:'child1' – Keshav1007
沒有。仍然得到相同的錯誤。指定出口和組件值後 – Keshav1007