I need to do toggle operation on a element :
<p-overlayPanel #panel>...
I must take it in my .ts code:
@ViewChild('panel') someInput: ElementRef;
this.someInput.toggle()
and after I don't knwo what I have to do? anyone can help me?
you can get a reference of the overlayPanel component like this
@ViewChild('panel',{static:true}) panel: OverlayPanel;
then you can call toggle or show method but these method require a browser event or target element to align the panel
@ViewChild('elm',{static:true}) elm: ElementRef;
then you can call toggle method like this
ngOnInit(){
this.panel.toggle(null,this.elm.nativeElement)
}
demo 🚀
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With