且构网

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

Angular5 - TypeError:无法读取未定义的属性“模板"

更新时间:2022-05-08 21:26:55

我忘记定义操作的标题单元格.所以它抛出了那个错误.这是解决这个问题的代码.

I forgot to define the header cell for the actions. So it was throwing that error. Here is the code which solved this problem.

<ng-container matColumnDef="actions">
  <mat-header-cell *matHeaderCellDef></mat-header-cell>
  <mat-cell *matCellDef="let row">
    <button mat-button (click)="showDetails(row)">DETAILS</button>
    <button mat-button (click)="editItem(row)">EDIT</button>
    <button mat-button (click)="deleteItem(row)">DELETE</button>
  </mat-cell>
</ng-container>