flex-layout icon indicating copy to clipboard operation
flex-layout copied to clipboard

When using flex-layout ContentChildren is unavailable

Open phmello opened this issue 9 years ago • 3 comments

I've noticed that when Im using flex-layout inside a component's content the ContentChildren QueryList is empty when the directive is removed everything works normally. I've created a plunker with the example

phmello avatar Jan 24 '17 08:01 phmello

@phmello - very odd bug. And when I do this:

<parent-component fxLayout="column">
          <child-component></child-component>
          <child-component></child-component>
          <child-component></child-component>
      </parent-component>

all works great. Yet when part of content-projection, it does not work :

<parent-component>
    <div fxLayout="column">
          <child-component></child-component>
          <child-component></child-component>
          <child-component></child-component>
    </div>
</parent-component>

ThomasBurleson avatar Jan 24 '17 09:01 ThomasBurleson

@phmello - this is not an issue with Flex-Layout.

@ContentChildren() by default only queries top-level elements. But you can specify additional options to query for all descendents in the projected content:

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

See this working Plunker here.

Closing this issue as not-an-issue.

ThomasBurleson avatar Aug 09 '17 23:08 ThomasBurleson

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.