is there any way to put this object in the table of material in an angular form?

There is a slight mistake in your code as per documentation in your html the ng-container part will be like this as follows:

<ng-container matColumnDef="{{column}}" *ngFor="let column of displayColumns; index as i">
  <th mat-header-cell *matHeaderCellDef>
    {{ column=='first_name' ? 'First Name' : '' }}
  </th>
  <td mat-cell *matCellDef="let element">{{ element.first_name | json }}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayColumns"></tr>

The problem with your part was you were not iterating the displayColumns to extract each column and put in matColumnDef.

I hope this documentation in Angular material will help you.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top