有一个数据表/网格。 当双击那里的一个数据行时,需要将相关数据项传递给表单。此选定项(对象(具有许多属性。
在不逐个分配所选项目的属性值的情况下完成此操作的最佳方法是什么?
网页代码 :
<data-table
[items]="items"
[itemCount]="itemCount"
indexColumnVisible (reload)="reloadItems($event)"
(rowClick)="rowClick($event)"
(rowDoubleClick)="openDetailsVatCodeModel(newVatCodeModal)"
(rowDoubleClick)="rowDoubleClick($event)"
[rowTooltip]="rowTooltip">
rowDoubleClick(rowEvent) {
this.editVatdetails = rowEvent.row.item;
//here we need pass the item to form called "newVatCodeForm"
}
您可以使用[routerLink] 将对象 id 传递到元素中,然后单击到一个新组件中获取数据并填写表单:
<button [routerLink]="['/user', user.id]">
<md-icon>create</md-icon>
</button>