0

In my angular application I want to open a Matdialog on click of a button and when the dialog is open, the parent window should be DISABLED (Not editable).

I see most of the examples where parent window is editable.

Is there a way we can disable parent.

test.component.ts

export class TestComponent {   
  openDialog() {
    this.displayWindow()
  }
    
  displayWindow() {
    this.dialog.open(MyDialog, {
      height: '360px',
      width: '600px',
      data: {
        text : 'Selected Inputs'
      }
    });
  }
          
  @Component({
    selector: 'app-my-dialog',
    template: '<div style="text-align: center"  ><h2>Hi</h2><br><br>{{mydata.text}} <br><br><button  mat-raised-button mat-dialog-close >Ok</button></div>',
  })
  export class MyDialog {
    constructor(@Inject(MAT_DIALOG_DATA) public mydata: any) { }
  }
}
Alexis
  • 1,685
  • 1
  • 12
  • 30
user1015388
  • 1,283
  • 4
  • 25
  • 45
  • Not quite following. What does parent disabled / not editable mean? Are you referring to ability to click away to close the modal? There’s the `disableClose: true` config option in this case, [source](https://github.com/angular/components/blob/main/src/material/dialog/dialog-config.ts) – Andrew Allen Apr 13 '23 at 02:17
  • @Andrew, When the modal dialog is open, I should not be able to edit any fields on the parent window. – user1015388 Apr 13 '23 at 13:45

0 Answers0