primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.42k stars 4.59k forks source link

Table: No events emitted from dynamic <ng-content *ngTemplateOutlet> templates #15219

Open ilkomiliev opened 6 months ago

ilkomiliev commented 6 months ago

Describe the bug

I am trying to implement reusable table component, where I can pass the corresponding pTemplates as @Input() and utilize default templates where customization is not necessary, i.e.:

` ...

... `

and respectively:

@Input() bodyTmpl!: TemplateRef<any>;

Everything works fine, but the events are not anymore emitted. If I replace the dynamic template with the templates' code then the events are available.

Environment

see stackblitz

Reproducer

https://stackblitz.com/edit/github-c6s33v?file=src%2Fmain.ts,src%2Fapp%2Fapp.component.html

Angular version

17.3.3

PrimeNG version

17.12.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

see stackblitz

Browser(s)

all

Steps to reproduce the behavior

  1. Goto https://stackblitz.com/edit/github-c6s33v
  2. Open the Console
  3. After the table is loaded select some row

Expected behavior

  1. The row is marked as selected
  2. onRowSelected with the event details is printed in the console
ilkomiliev commented 1 week ago

I found the answer on SO

Anyway, I'd expect this to be included in the official documentation please.