Reputation: 140
I create dynamic component:
const comp = createComponent(componentType,
{
environmentInjector: this.appRef.injector,
elementInjector: parentComponentInjector,
}
);
I can add projectableNodes
like this:
const comp = createComponent(componentType,
{
environmentInjector: this.appRef.injector,
projectableNodes: [...childCompnents]
}
);
That way I can add projectableNodes
but the problem is that I need to create childComponents
before I parentComponent
. Therefore I cannot inject them with parentComponentInjector
and I cannot take adventage of chierachical DI Angular has, beacuse to get the parentInjector
I need to create parentComponent
before childComponents
.
Is there a way I can use both projectableNode
and Angular DI?
Upvotes: 0
Views: 110