简体   繁体   English

禁用外部单击对话框 angular 材料

[英]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.下面的代码示例使用 disableClose 作为 boolean 变量来禁用对话框的关闭。

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 .查看 API: https://material.angular.io/components/dialog/api

disableClose is part of MatDialogConfig that should be passed to dialog when opening it. disableCloseMatDialogConfig的一部分,在打开对话框时应将其传递给对话框。 This guide has a good example: https://blog.angular-university.io/angular-material-dialog/本指南有一个很好的例子: https://blog.angular-university.io/angular-material-dialog/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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