Syed Faizan
Syed Faizan

Reputation: 961

How to reload the contents of a PrimeNG Dialog

I am using Angular PrimeNG and I have the following scenario

<button (click)="display = !display">Open</button>
<p-dialog [(visible)]="display">
    <custom-component [uid]="userId"></custom-component>
</p-dialog> 

Problem here is whenever I try to open the p-dialog, the custom component is not called again, how do I make sure the component is loaded again to make sure the modal has latest data every time its opened?

Upvotes: 1

Views: 3234

Answers (1)

Iulian Cucoanis
Iulian Cucoanis

Reputation: 205

One way is to add an *ngIf statement to the component. So whenever the flag is false the component is destroyed. Opening the dialog again should create the component again.

Upvotes: 5

Related Questions