I have a component and I need the list of my content children as TemplateRef
.
If I read them with:
@ContentChildren(ToggleComponent) toggles: QueryList<ToggleComponent>;
Then it works, toggles._results
is an array of objects of type ToggleComponent
, and that's the expected behavior. I want the TemplateRef
instead, so I tried:
@ContentChildren(ToggleComponent, {read: TemplateRef}) toggles: QueryList<ToggleComponent>;
But in this case toggles._results
is an array of undefineds:
[undefined, undefined, undefined]
Why doesn't it work?
Here is a minimal reproduction of the error, you can see the QueryList
object in the console.