Skip to content

Commit

Permalink
demo(dialog): add fields for minWidth, minHeight, maxWidth and maxHeight
Browse files Browse the repository at this point in the history
Not adding `minWidth`, `minHeight`, `maxWidth` and `maxHeight` to `config` to avoid overriding the default value of `maxWidth` particularly—the type checker will require it to be a string. Instead, setting `config` to type `MatDialogConfig` is prefered to appease the type checker since those four properties are optional.
  • Loading branch information
emilio-martinez committed Oct 3, 2017
1 parent f4c23b9 commit 0cc61ae
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions src/demo-app/dialog/dialog-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ <h2>Dialog dimensions</h2>
</mat-form-field>
</p>

<p>
<mat-form-field>
<input matInput [(ngModel)]="config.minWidth" placeholder="Min Width">
</mat-form-field>
<mat-form-field>
<input matInput [(ngModel)]="config.minHeight" placeholder="Min Height">
</mat-form-field>
</p>

<p>
<mat-form-field>
<input matInput [(ngModel)]="config.maxWidth" placeholder="Max Width">
</mat-form-field>
<mat-form-field>
<input matInput [(ngModel)]="config.maxHeight" placeholder="Max Height">
</mat-form-field>
</p>

<h2>Dialog position</h2>

<p>
Expand Down
4 changes: 2 additions & 2 deletions src/demo-app/dialog/dialog-demo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Component, Inject, ViewChild, TemplateRef} from '@angular/core';
import {DOCUMENT} from '@angular/platform-browser';
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material';
import {MatDialog, MatDialogConfig, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material';


@Component({
Expand All @@ -14,7 +14,7 @@ export class DialogDemo {
lastAfterClosedResult: string;
lastBeforeCloseResult: string;
actionsAlignment: string;
config = {
config: Partial<MatDialogConfig> = {
disableClose: false,
panelClass: 'custom-overlay-pane-class',
hasBackdrop: true,
Expand Down

0 comments on commit 0cc61ae

Please sign in to comment.