79164551

Date: 2024-11-06 23:15:16
Score: 2
Natty:
Report link

No, I don't think this is possible.

I've been trying to implement it for a few days because I have a code base I am refactoring to use ag-grid, which had previously used <ng-template to render its cell components. The most logical way to go about it would be to set a @viewChild() to bring the ng-template reference into the component layer and then set it as the cellRenderer of the column, but I have been unable to make this work.

I think we have to take the more long winded approach and set up Components with their own templates. They have pretty good documentation on how to do it (https://www.ag-grid.com/angular-data-grid/components/) and I was able to use the child to parent communication to reduce the amount of refactoring required to split ng-templates out to their own components.

I agree, it would be awesome if they add support for ng-template references for all the times we need relatively simple cell components.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • User mentioned (1): @viewChild
  • Low reputation (1):
Posted by: Zane Geiser