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
I ran into this problem as well and the reason was that the location which I wanted to load my component dynamicly into was inside an ng-if that was hidden initially.
@ViewChild(InputHostDirective, { static: true }) inputHost: InputHostDirective;
Moving the ng-template to outside the ng-if solved the problem.