Cannot read property 'viewContainerRef' of undefined

前端 未结 8 789
鱼传尺愫
鱼传尺愫 2021-01-01 13:50

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         


        
8条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-01 14:29

    In Angular 8 my fix was:

    @ViewChild('dynamicComponent', {static: true, read: ViewContainerRef}) container: ViewContainerRef;

提交回复
热议问题