In scenario when I have
parent component:
<button (click)="panel.toggle($event)">Click</div>
child:
<child></child> which has the reference
and includes
<p-overlayPanel #panel>
Content
</p-overlayPanel>
How can I access #panel reference from parent component? PrimeNG overlay panel
@ViewChild(‘panel’) panel: ParentComponent
使用@ViewChild()
装饰器,您可以从父组件访问子组件
You can toggle: this.panel.show(); this.panel.hide();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.