我不知道为什么路由器不会匹配任何给定的路由...我什至尝试过非常简单的路由,但都失败了。
我的路线(摘录):
{
path: ':rootFolder/',
children: [
{
path: 'name/**',
component: MainComponent,
},
{
path: 'name/*', // Debugging only
component: MainComponent,
},
{
path: 'name', // Debugging only
component: MainComponent,
},
{
path: '',
component: MainComponent,
pathMatch: 'full',
},
],
},
{
path: ':rootFolder/:currentFolder/',
children: [
{
path: 'name/**',
component: MainComponent,
},
{
path: '',
component: MainComponent,
pathMatch: 'full',
},
],
},
Run Code Online (Sandbox Code Playgroud)
另外,我确信,这些路由正在被路由器接受,就像我使用一样UrlMatcher,我会得到正确的行为。我只想使用标准的内置解决方案而不是这个......
解决这个问题是一回事,但我很想了解原因并可能帮助其他人......
您可以通过以下方式启用路由调试:
声明设置对象
const settings: ExtraOptions = {
enableTracing: true,
};
Run Code Online (Sandbox Code Playgroud)
然后在声明路由器时使用它:
RouterModule.forRoot(routes, settings)],
Run Code Online (Sandbox Code Playgroud)
这样做,您将在浏览器控制台中看到输出。
注意:您还可settings以内联压缩对象。
| 归档时间: |
|
| 查看次数: |
538 次 |
| 最近记录: |