且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在角度材料表中的垫行上添加单击事件

更新时间:2023-01-24 20:26:46

与上面几乎相同的解决方案,但如果您尝试从单击的行中获取对象,则更有用

almost the same solution as above but a bit more useful if you are trying to get the object from the clicked row

<mat-row  *matRowDef="let row; columns: displayedColumns;" (click)="getRecord(row)"></mat-row>

当您控制台记录该行时,您将获得该行的整个对象

when you console log the row you will get the entire object of the row