不确定尝试从一个子路线导航到另一条子路线时为什么会出现此错误。
ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'playlist-edit/display-tracks/artist/0i3rXQVnr4SE5pl3qtBM2o'
Error: Cannot match any routes. URL Segment: 'playlist-edit/display-tracks/artist/0i3rXQVnr4SE5pl3qtBM2o'
at ApplyRedirects.push../node_modules/@angular/router/fesm5/router.js.ApplyRedirects.noMatchError (router.js:2469)
at CatchSubscriber.selector (router.js:2450)
at CatchSubscriber.push../node_modules/rxjs/_esm5/internal/operators/catchError.js.CatchSubscriber.error (catchError.js:34)
at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:80)
at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (Subscriber.js:60)
at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:80)
at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (Subscriber.js:60)
at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:80)
at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (Subscriber.js:60)
at TapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/tap.js.TapSubscriber._error (tap.js:61)
at resolvePromise (zone.js:831)
at resolvePromise (zone.js:788)
奇怪的是,它以“ playlist-edit / display-tracks / artist / 0i3rXQVnr4SE5pl3qtBM2o”的形式显示了该路线的确切路径。这就是我要导航的路线。
我尝试了许多不同的方法,甚至在其他地方移动路线。
功能模块的路线:
父模块的初始化路径为:
/播放列表编辑
const ROUTES = [
{
path: "",
component: PlaylistEditComponent,
children: [
{
path: "",
pathMatch: 'full',
redirectTo: 'playlist-add'
},
{
path: 'playlist-add',
component: PlaylistAddComponent
},
{
path: 'display-tracks/type/id',
resolve: {trackData: DisplayTracksResolverService},
component: DisplayTracksComponent
},
{path: 'playlist/:id', component: PlayListComponent}
]
}
];
我在PlaylistAddComponent中,想导航到“显示轨道/类型/ ID”
所以我在该组件的路由器上称呼它:
this.router.navigate(['../display-tracks', entity.type, entity.id], {relativeTo: this.route});
对我来说,“向上走一条到父路线,然后向下走直到找到/ display-tracks / type / id
看起来很简单。
我想加载DisplayTracksComponent。
有什么想法吗?谢谢