簡體   English   中英

從輔助路線導航到另一個子路線

[英]Navigation from auxiliary route to another child route

我有路線:

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}}]));

命名路由的路由器 state 與主出口 state 分開存儲。無法同時從一個路由導航到另一個路由。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM