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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…