Instead of a regular way of displaying data to table. I'm trying to create my custom-table component and project the data in the material table via .
like this:
<table mat-table [dataSource]="dataSource">
<!-- I want to Render the header and cell data here -->
<ng-content></ng-content>
<mat-header-row *matHeaderRowDef="headers; sticky: true"></mat-header-row>
<mat-row *matRowDef="let row; columns: headers;"></mat-row>
</table>
So I can call this customized component like this:
<app-customized-table>
<ng-container matColumnDef="id">
<mat-header-cell *matHeaderCellDef> Id </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.Id}} </mat-cell>
</ng-container>
...etc
</app-customized-table>
However, it won't detect the content. Here's a stackblitz example that i'm trying to do.
https://stackblitz.com/edit/angular-qwvcln?file=src%2Fapp%2Fcustom-table.component.ts
Is there a way to do this?
Thanks.