I use Angular Material Tables. And display in a table a list of columns (displayedColumns).
I need to display the "birthday" column using the "date" filter ({{element[column] | date}}
), but let other columns as is. How do I say, if the column=="birthday" then apply the filter "date"?
<ng-container matColumnDef="{{column}}" *ngFor="let column of displayedColumns">
<th mat-header-cell *matHeaderCellDef> {{column}} </th>
<td mat-cell *matCellDef="let element"> {{element[column]}} </td>
</ng-container>
Try that :
<ng-container matColumnDef="{{column}}" *ngFor="let column of displayedColumns">
<th mat-header-cell *matHeaderCellDef> {{column}} </th>
<td mat-cell *matCellDef="let element"> {{column === 'birthday' ? (element[column] | date) : element[column]}} </td>
</ng-container>