There are two ways to resize the MatDialog component in the corner material.
.1) The external component that invokes the dialog component
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material'; dialogRef: MatDialogRef <any> ; constructor(public dialog: MatDialog) { } openDialog() { this.dialogRef = this.dialog.open(TestTemplateComponent, { height: '40%', width: '60%' }); this.dialogRef.afterClosed().subscribe(result => { this.dialogRef = null; }); }
2) Inside the dialog component. dynamically resize it
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material'; constructor(public dialogRef: MatDialogRef<any>) { } ngOnInit() { this.dialogRef.updateSize('80%', '80%'); }
use updateSize () in any function in the dialog component. it will automatically resize the dialog.
for more information check this link https://material.angular.io/components/component/dialog
source share