Disable auto focus in dialog- modal in Angular 2+ material

0
1926

Since @angular/material@5.0.0-rc.1 there is special option autoFocus on MatDialogConfig

/** Whether the dialog should focus the first focusable element on open. */
autoFocus?: boolean = true;

So you can use it as follows:

let dialogRef = this.dialog.open(ContactPersonEditComponent, {
  width: '250px',
  data: {
          data : Object.assign({},data),
        },
  autoFocus: false   <============================== this line
});

LEAVE A REPLY

Please enter your comment!
Please enter your name here