In my app, I'm using AG-Grid. In one of the columns, I want to use a custom color pipe that I have created. I'm using cellRenderer to achieve that but I get the error below. My code is below, what am I doing wrong and what should I fix?
Pipe:
@Pipe({ name: 'ticketStateColor' })
export class TicketStateTypePipe implements PipeTransform {
transform(state: any): string {
if (state == 1) return 'accent';
if (state == 2) return 'orange-800';
if (state == 3) return 'green';
if (state == 4) return 'orange';
if (state == 5) return 'red';
if (state == 6) return 'teal';
if (state == 7) return 'accent';
return '';
}
}
TS:
{
columnGroupShow: 'open', headerName: 'Durum', field: 'TicketStateType.Name', cellRenderer: TicketStateTypePipe,
cellRendererParams:
`<td mat-cell *matCellDef="let row">
<div fxLayout="column" fxLayoutAlign="center start">
<div [ngClass]="params.data.TicketStateType?.Name | ticketStateColor" class="text-boxed mb-2">
{{params.data?.TicketStateType?.Id}}</div>
</div>
</td>`
},
