I am trying to display a dynamic component similar (not exact) to the example in angular docs.
I have a dynamic directive with viewContainerRef
@Dire
Noted that I face the same problem if directive selector (dynamicComponent in this case) is at :
first element of the component
parent element with *ngIf condition
Hence, I avoid it by put it inside at non-root tag in the component html & load component to viewContainerRef only when the condition match.