How to access host component from directive?

前端 未结 6 469
北荒
北荒 2020-12-08 01:56

Say I have the following markup:


Is there any way I can access the component instance

6条回答
  •  猫巷女王i
    2020-12-08 02:40

    constructor(private vcRef: ViewContainerRef){
            let parentComponent=(this.vcRef)._view.context;
    }
    

提交回复
热议问题