How to put buttons in Angular mat-table?

Add the cell column definition matHeaderCellDef for the mat header cell

<ng-container matColumnDef="actions">
  <mat-header-cell  *matHeaderCellDef > Actions </mat-header-cell>
  <mat-cell *matCellDef="let row" >
       <button mat-button >Edit</button>
  </mat-cell>
</ng-container>

This answer helped me a lot. however, I just want to add that in the matColumnDef="actions" you refer to the column actions, which should also be included in the component displayedColumns variable.

displayedColumns = ['id','name','price'...etc., 'actions']

Tags:

Angular