Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to open Md-dialog full screen angular4?

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?

like image 455
Shailesh Ladumor Avatar asked Mar 28 '18 09:03

Shailesh Ladumor


People also ask

How do you use a MatDialogModule?

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.

What is Mat dialog close?

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({/* ...


2 Answers

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

like image 158
San Jaisy Avatar answered Oct 13 '22 07:10

San Jaisy


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;
}
like image 29
Ketan Akbari Avatar answered Oct 13 '22 08:10

Ketan Akbari