【发布时间】:2020-04-04 09:30:28
【问题描述】:
我不知道为什么点击行后我的路由没有发生。 没有错误显示。 URL 中的路径从“http://localhost:4200/vendor-list”更改为“http://localhost:4200/vendor-list/vendor” 但是页面没有变化。
vendorlist.component.html
<tr mat-header-row *matHeaderRowDef="ordersDisplayedColumns"></tr>
<tr (click)="displayData(row)" mat-row *matRowDef="let row; columns: ordersDisplayedColumns;"></tr>
</table>
vendorlist.component.ts
displayData(row)
{
console.log(row);
this.router.navigate(["/vendor-list/vendor/"]);
}
myrouting.module.ts
{path:'vendor-list',component:VendorlistComponent,
children:[
{path:'vendor',component:VendorComponent,
]},
【问题讨论】:
-
我想你的一位同事已经问过这个问题了stackoverflow.com/a/61029475/5429428
-
这能回答你的问题吗? How to route after clicking row of mat table
标签: angular typescript angular-routing