Hi,
I am using p-dialog to show some content on the screen upon request.
To Achieve this I have written a component which handles UI and the backend call to get the data.
I am using component as in below code snippet to show the content on the fly.
<p-dialog [(visible)]="displayDiag" [width]="1200" [height]="400" [modal]="true" [blockScroll]="true" header="Header" >
<app-viewLatestStatus [objectType]="objectType" [objectId]="objectId">
</app-viewLatestStatus>
</p-dialog>
I've written code to call backend in ngOnInit() of app-viewLatestStatus component.
My query is how do I call backend and refresh the data in dialog every time the dialog is shown/displyed.
p-dialog how to reload content on dialog load
Add an ngIf statement and the component will load fresh and call ngOnInit every time you open the dialog. Link the ngIf to the exact same value as the visible toggle (displayDiag).
Code: Select all
<p-dialog [(visible)]="displayDiag" [width]="1200" [height]="400" [modal]="true" [blockScroll]="true" header="Header" *ngIf="displayDiag">
<app-viewLatestStatus [objectType]="objectType" [objectId]="objectId">
</app-viewLatestStatus>
</p-dialog>
-
- Information
-
Who is online
Users browsing this forum: No registered users and 5 guests