Hi
I am using Angular Material dialog. I want when user clicks Cancel button it should gets closed.
Employee Form
Thanks
Hi
I am using Angular Material dialog. I want when user clicks Cancel button it should gets closed.
Employee Form
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mayooran NavamanyPosted Jun 7, 2024, 4:35 PM
HTML Template: Add a "Cancel" button within your form. Use Angular's
(click)event binding to call a method in your component to handle the dialog close action.Component: Inject
MatDialogRefin the constructor of your component and define theonCancelmethod to close the dialog.In this setup:
MatDialogRefservice is used to control the dialog from within the component.onCancelmethod calls theclosemethod ondialogRef, which closes the dialog.FormBuilderandFormGroup).Jaimin ShethiyaPosted Jun 7, 2024, 7:20 AM
Hello Ramco,
user-dialog.component.html
user-dialog.component.ts
app.module.ts
Thanks