this is duplicated Question, you can find old question from this link,
also for answering this you can use disableClose
when try to open the MatDialogConfig
.
however, you need to add code for enabling closing when click on the backdrop to close the dialog.
let dialogRef = this.dialog.open(EditPlaceDialogComponent, { disableClose: true /* Your other config options here */ });
/*
Subscribe to events emitted when the backdrop is clicked
NOTE: Since we won't actually be using the `MouseEvent` event, we'll just use an underscore here
See https://stackoverflow.com/a/41086381 for more info
*/
dialogRef.backdropClick().subscribe(_ => {
// Close the dialog
dialogRef.close();
})