1
votes

I'm trying to get a children component of another component, is it possible? For example, I have this QueryList:

@ContentChildren(SysColumn) syscolumns: QueryList<SysColumn>;

It will create a QueryList of all the SysColumns classes instanciated, that's perfectp, but i need to get a list of the child components inside of SysColums... The HTML will be like this:

<parent>    
 <sys-column>
  <child></child>
 </sys-column>
 <sys-column>
   <child></child>
 </sys-column>
</parent>

If I do a Foreach of the QueryList it will show the two SysColms, but now I need to have the inner components. How can I achieve it

2
I already declare it in the father component, i need to have something like a ContentChildren that i can access trough the father component - Hely Saul Oberto

2 Answers

1
votes

If you want to query Child components, @ContentChildren() needs to look like

@ContentChildren(Child, {descendants: true}) children: QueryList<Child>;

{descendants: true} might be the default anyway (don't remember)