Skip to content

Commit 0cc61ae

Browse files
demo(dialog): add fields for minWidth, minHeight, maxWidth and maxHeight
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.
1 parent f4c23b9 commit 0cc61ae

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/demo-app/dialog/dialog-demo.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,24 @@ <h2>Dialog dimensions</h2>
2323
</mat-form-field>
2424
</p>
2525

26+
<p>
27+
<mat-form-field>
28+
<input matInput [(ngModel)]="config.minWidth" placeholder="Min Width">
29+
</mat-form-field>
30+
<mat-form-field>
31+
<input matInput [(ngModel)]="config.minHeight" placeholder="Min Height">
32+
</mat-form-field>
33+
</p>
34+
35+
<p>
36+
<mat-form-field>
37+
<input matInput [(ngModel)]="config.maxWidth" placeholder="Max Width">
38+
</mat-form-field>
39+
<mat-form-field>
40+
<input matInput [(ngModel)]="config.maxHeight" placeholder="Max Height">
41+
</mat-form-field>
42+
</p>
43+
2644
<h2>Dialog position</h2>
2745

2846
<p>

src/demo-app/dialog/dialog-demo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Component, Inject, ViewChild, TemplateRef} from '@angular/core';
22
import {DOCUMENT} from '@angular/platform-browser';
3-
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material';
3+
import {MatDialog, MatDialogConfig, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material';
44

55

66
@Component({
@@ -14,7 +14,7 @@ export class DialogDemo {
1414
lastAfterClosedResult: string;
1515
lastBeforeCloseResult: string;
1616
actionsAlignment: string;
17-
config = {
17+
config: Partial<MatDialogConfig> = {
1818
disableClose: false,
1919
panelClass: 'custom-overlay-pane-class',
2020
hasBackdrop: true,

0 commit comments

Comments
 (0)