How to call angular function when click p-dialog close(X) button?
I have searched and just tried this
(onHide)="cancel()"
. But it's not working. Kindly share your solutions.
I know we can use a close/cancel
button to hide the popup. But in my scenario I want to call an event when clicking the (X) button click.
Actually
(onHide)="cancel()"
works fine according to this Plunkr.A workaround is to use a boolean to display the p-dialog with
You set that boolean to true when you want to display the p-dialog Then use the (click) event. For instance
In your ts do
You should to use two events follow:
use in html as
Refer: https://github.com/primefaces/primeng/issues/956
Try: (click)="cancel()" instead.
I had the same error but I solved it by using the click method. Grettings :)