且构网

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

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

更新时间:2022-05-08 21:27:13

我忘记定义动作的标题单元格了.因此它引发了该错误.这是解决此问题的代码.

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>