[Angular] How to return a component for a cell? #5662
-
I'm having trouble figuring out how to use an Angular component to be rendered as cell contents. In ag-grid I could use the
I didn't see anything in the API docs that stood out to me. I've seen the question asked for React where you can return JSX in the return of the cell function. But that doesn't work for me. In the example below, at first the output for the first row viewed in dev tools was just
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello, did you try with something like: https://tanstack.com/table/latest/docs/framework/angular/angular-table? In my case I needed to display column with percent pipe: interface X {
percentageValue: number,
}
public readonly columns: ColumnDev<X>[] = [{
accessorKey: 'percentageValue',
cell: data => new FlexRendererComponent(PercentageCellComponent, { value: data.getValue<number>(), }),
}];
@Component({
standalone: true,
selector: 'app-table-percentage-cell',
imports: [PercentPipe],
template: `
{{ value() | percent }}
`,
})
export class PercentageCellComponent {
public readonly value = input.required<number>();
} |
Beta Was this translation helpful? Give feedback.
Hello, did you try with something like: https://tanstack.com/table/latest/docs/framework/angular/angular-table?
In my case I needed to display column with percent pipe: