我有路线:
const routes: Routes = [
{path: 'all', component: NodepadComponent, children: [
{path: 'create', component: NotepadCreateComponent},
{path: 'note/:id', component: NotepadItemComponent, outlet: 'item'}]
}];
我想从";项目";路由到";创建";路线
我试过这个:
constructor(
private route: ActivatedRoute,
private router: Router,
){ }
this.router.navigate(['create', {outlets: {item: null}}],
{relativeTo: this.route.parent });
但结果是(/all/(create//item:note/1(
如何删除";项目";路线和导航只创建路线?感谢
this.router.navigate(['create']).then(() => this.router.navigate([{outlets: {item: null}}]));
命名路由的路由器状态与主出口状态分开存储。没有办法同时从一个导航到另一个。