user1015388
user1015388

Reputation: 1515

Angular Material Dialog with Parent window diabled

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) { }
  }
}

Upvotes: 0

Views: 79

Answers (0)

Related Questions