简体   繁体   中英

Disable outside click dialog box angular material

Ive added code to disable the outside click closing of the dialog box. This isnt working, can anybody tell me where am i wrong here? Here is code example below is used disableClose as the boolean variable to disable the closing of the dialog box.

openDialog(): void {
    const dialogRef = this.dialog.open(TempDialog, { disableClose: true }) {
      data: { person: " ", place: "", thing: this.thing }
    });

    dialogRef.afterClosed().subscribe(result => {
      dialogRef.disableClose = true;
}

Checkout the API: https://material.angular.io/components/dialog/api .

disableClose is part of MatDialogConfig that should be passed to dialog when opening it. This guide has a good example: https://blog.angular-university.io/angular-material-dialog/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM