I have created my custom table using angular material.
this is the source code.
I try to add an option to pass custom row template so I will be sent it like that:
<my-table [dataSource]="data">
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</my-table>
So i added @ContentChildren(MatRowDef) row: MatRowDef<any>;
to my table component, and trying to use it in the template:
<ng-container *ngIf="row; else defaultRowTemplate" [ngTemplateOutlet]="row.template">
</ng-container>
<ng-template #defaultRowTemplate>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</ng-template>
but it is not working, there is some way to do it correctly?
link to stackblitz.