I am trying to pass some property value using config. But dialog not open into full screen.
openTwigTemplate(): void {
let config = new MdDialogConfig();
config = {
position: {
top: '10px',
right: '10px'
},
height: '98%',
width: '100vw',
};
const dailog = this.dialog.open(TwigDialogComponent, config);
}
How can I open dialog full screen based on resolution?
In the dialog component, we need to create an instance of 'MatDialogRef' which we should import from '@angular/material/dialog'. Import 'MatDialogModule' from '@angular/material' in app. module. ts file.
Components created via MatDialog can inject MatDialogRef and use it to close the dialog in which they are contained. When closing, an optional result value can be provided. This result value is forwarded as the result of the afterClosed Observable. @Component({/* ...
This work for me
let dialogRef = this.dialog.open(CustomerGarageAddEditComponent, {
maxWidth: '100vw',
maxHeight: '100vh',
height: '100%',
width: '100%'
});
Source
https://github.com/angular/material2/issues/9823
You can add a panelClass
to the dialog and then apply whatever css just to that specific dialog.
openTwigTemplate(): void {
let config = new MdDialogConfig();
config = {
position: {
top: '10px',
right: '10px'
},
height: '98%',
width: '100vw',
panelClass: 'full-screen-modal',
};
const dailog = this.dialog.open(TwigDialogComponent, config);
}
Create class:
.full-screen-modal .mat-dialog-container {
max-width: none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With