Reputation: 11599
I have an angular component inside a modal dialog. When the dialog is closed, I want to delay closing of the modal dialog.
How can I add delay for 5 seconds inside an Angular component before closing it?
Upvotes: 2
Views: 5910
Reputation: 3389
One way you can delay your dialog is, by using timeOut, And you can also pass some information back to your modal dialog.
onCloseClickHandler(e: any): void {
setTimeout(() => {
this.dialogRef.close(e);
}, 5000);
}
Upvotes: 0
Reputation: 1363
You can have an event handler like "onClose" in whatever dialog you are using and add delay in that, then close the modal.
onNoClick(): void {
setTimeout(()=>{
this.dialogRef.close();
},5000);
}
Upvotes: 2