我有the following plunker ,这是行不通的。为了让它工作,我可以注释掉......
RouterModule.forRoot([
{
path: "",
component: TestComponent,
children: [
// {
// path:"",
// outlet: "other",
// component: TestComponent
// }
]
}
])
如果我不这样做,我就会......
EXCEPTION: Uncaught (in promise): Error: Cannot match any routes. URL Segment: ''
Error: Cannot match any routes. URL Segment: ''
如何添加子路线?
最佳答案
您应该提供不同的路径名,直到使用pathMatch: 'full'
。 Forked .
有关该主题的更多信息,请参阅 Angular Router: Empty Paths, Componentless Routes, and Redirects .
关于angular - 无法匹配任何路线。 URL段: '' : When trying to use child routes and Ng2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40566685/