I am working on a component that can render a mat-table. Each cell can have a specified value, or if it is present, the component calls an ngTemplateOutlet and passes it a rendering function obtained from the calling object.
export interface ColumnConfig {
name: string;
headerTemplate?: TemplateRef<Element>;
headerLabel?: string;
headerClasses?:string;
bodyTemplate?: TemplateRef<Element>;
bodyClasses?:string;
visible?: boolean;
align?: string;
}
<mat-cell mat-cell *matCellDef="let element">
<ng-container *ngIf="!column.bodyTemplate; else bodyTemplate">
{{ element[column.name] }}
</ng-container>
<ng-template #bodyTemplate [ngTemplateOutlet]="column.bodyTemplate!" [ngTemplateOutletContext]="{ $implicit: element }"></ng-template>
</mat-cell>
After updating many project dependencies such as typescript, angular, tslint->eslint, I am now encountering an error that was not present before.
Object literal may only specify known properties, and '"$implicit"' does not exist in type 'Element'.
I am struggling to figure out how to accurately define the element which is specified by the "let" of the "matCellDef".
Thank you!