带有参数的角形辅助路由器未定义

问题描述 投票:0回答:1

我有一个表单(A)组件,可以使用按钮导航到另一个组件中的另一个表单(B)。现在,该应用程序还具有一个侧栏,该侧栏应该具有到两个表单组件的链接。表单A已预先填充,并使用id进行检索。现在,当我尝试将路由器链接添加到辅助路由器链接的侧栏中时,它说链接未定义(/未定义)。下面是代码。

{path:'a/:id' , component: AComponent }, 
{path:'b/:id' , component: BComponent },    
{ path: 'a/:id',component: AComponent,outlet: "sidebar" }

我使用的HTML中的routerlink是[routerLink]="[{outlets:{'sidebar':['/a',data.id]}}]"-显示未定义

对于正在运行的按钮[routerLink]="['/b',data.id]

angular routing routerlink angular-routerlink angular-auxiliary-routes
1个回答
0
投票

如果data.id在此处有效,请使用[routerLink] =“ ['/ b /'+ data.id]

© www.soinside.com 2019 - 2024. All rights reserved.