I am using the ComponentFactoryResolver
to dynamically create an element to be inserted into my template, which uses ng-content
for transclusion.
It all works wonderfully until I add a select
attribute to my ng-content
. Please see this plunker which demonstrates the problem. If I remove the content-top
attribute from my HeaderComponent
template on line 63 of app.ts
, the template renders as expected.
I do however need to use select
because there are two different template fragments to be injected so I can't simply remove it.
Any help appreciated.
content-top
attribute on line 63 i don't see the difference. If i removeselect
fromng-content
i see thatHeaderComponent
is renderedselect="[content-host]"
plnkr.co/edit/DXCBACANjufthKMgNeSE?p=previewselect
from line 18. I need to be able to select elements that are replaced in theng-template
and<ng-template content-host>
is replaced anyway. The<h1 top-content>
will be the top level in this case.because there are two different template fragments to be injected so I can't simply remove it.
Can you expand your example? Which fragments will be also injected?