Angular5 - TypeError: Cannot read property 'template' of undefined

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>

I faced this error because, I forget to add th and td in ng-container

<ng-container matColumnDef="actions">

</ng-container>