|
| 1 | +<h1>Dialog demo</h1> |
| 2 | + |
| 3 | +<button mat-raised-button color="primary" (click)="openJazz()"> |
| 4 | + Open dialog |
| 5 | +</button> |
| 6 | +<button mat-raised-button color="accent" (click)="openContentElement()"> |
| 7 | + Open dialog with content elements |
| 8 | +</button> |
| 9 | +<button mat-raised-button color="accent" (click)="openTemplate()"> |
| 10 | + Open dialog with template content |
| 11 | +</button> |
| 12 | + |
| 13 | +<p> |
| 14 | + <mat-checkbox [(ngModel)]="enableLegacyPadding">Enable legacy padding</mat-checkbox> |
| 15 | +</p> |
| 16 | + |
| 17 | +<mat-card class="demo-dialog-card"> |
| 18 | + <mat-card-content> |
| 19 | + <h2>Dialog dimensions</h2> |
| 20 | + |
| 21 | + <p> |
| 22 | + <mat-form-field> |
| 23 | + <mat-label>Width</mat-label> |
| 24 | + <input matInput [(ngModel)]="config.width"> |
| 25 | + </mat-form-field> |
| 26 | + <mat-form-field> |
| 27 | + <mat-label>Height</mat-label> |
| 28 | + <input matInput [(ngModel)]="config.height"> |
| 29 | + </mat-form-field> |
| 30 | + </p> |
| 31 | + |
| 32 | + <p> |
| 33 | + <mat-form-field> |
| 34 | + <mat-label>Min width</mat-label> |
| 35 | + <input matInput [(ngModel)]="config.minWidth"> |
| 36 | + </mat-form-field> |
| 37 | + <mat-form-field> |
| 38 | + <mat-label>Min height</mat-label> |
| 39 | + <input matInput [(ngModel)]="config.minHeight"> |
| 40 | + </mat-form-field> |
| 41 | + </p> |
| 42 | + |
| 43 | + <p> |
| 44 | + <mat-form-field> |
| 45 | + <mat-label>Max width</mat-label> |
| 46 | + <input matInput [(ngModel)]="config.maxWidth"> |
| 47 | + </mat-form-field> |
| 48 | + <mat-form-field> |
| 49 | + <mat-label>Max height</mat-label> |
| 50 | + <input matInput [(ngModel)]="config.maxHeight"> |
| 51 | + </mat-form-field> |
| 52 | + </p> |
| 53 | + |
| 54 | + <h2>Dialog position</h2> |
| 55 | + |
| 56 | + <p> |
| 57 | + <mat-form-field> |
| 58 | + <mat-label>Top</mat-label> |
| 59 | + <input matInput [(ngModel)]="config.position.top" (change)="config.position.bottom = ''"> |
| 60 | + </mat-form-field> |
| 61 | + <mat-form-field> |
| 62 | + <mat-label>Bottom</mat-label> |
| 63 | + <input matInput [(ngModel)]="config.position.bottom" (change)="config.position.top = ''"> |
| 64 | + </mat-form-field> |
| 65 | + </p> |
| 66 | + |
| 67 | + <p> |
| 68 | + <mat-form-field> |
| 69 | + <mat-label>Left</mat-label> |
| 70 | + <input matInput [(ngModel)]="config.position.left" (change)="config.position.right = ''"> |
| 71 | + </mat-form-field> |
| 72 | + <mat-form-field> |
| 73 | + <mat-label>Right</mat-label> |
| 74 | + <input matInput [(ngModel)]="config.position.right" (change)="config.position.left = ''"> |
| 75 | + </mat-form-field> |
| 76 | + </p> |
| 77 | + |
| 78 | + <h2>Dialog backdrop</h2> |
| 79 | + |
| 80 | + <p> |
| 81 | + <mat-form-field> |
| 82 | + <mat-label>Backdrop class</mat-label> |
| 83 | + <input matInput [(ngModel)]="config.backdropClass"> |
| 84 | + </mat-form-field> |
| 85 | + </p> |
| 86 | + |
| 87 | + <mat-checkbox [(ngModel)]="config.hasBackdrop">Has backdrop</mat-checkbox> |
| 88 | + |
| 89 | + <h2>Other options</h2> |
| 90 | + |
| 91 | + <p> |
| 92 | + <mat-form-field> |
| 93 | + <mat-label>Button alignment</mat-label> |
| 94 | + <mat-select [(ngModel)]="actionsAlignment"> |
| 95 | + <mat-option>Start</mat-option> |
| 96 | + <mat-option value="end">End</mat-option> |
| 97 | + <mat-option value="center">Center</mat-option> |
| 98 | + </mat-select> |
| 99 | + </mat-form-field> |
| 100 | + </p> |
| 101 | + |
| 102 | + <p> |
| 103 | + <mat-form-field> |
| 104 | + <mat-label>Dialog message</mat-label> |
| 105 | + <input matInput [(ngModel)]="config.data.message"> |
| 106 | + </mat-form-field> |
| 107 | + </p> |
| 108 | + |
| 109 | + <p> |
| 110 | + <mat-checkbox [(ngModel)]="config.disableClose">Disable close</mat-checkbox> |
| 111 | + </p> |
| 112 | + </mat-card-content> |
| 113 | +</mat-card> |
| 114 | + |
| 115 | +<p>Last afterClosed result: {{lastAfterClosedResult}}</p> |
| 116 | +<p>Last beforeClose result: {{lastBeforeCloseResult}}</p> |
| 117 | + |
| 118 | +<ng-template let-data let-dialogRef="dialogRef"> |
| 119 | + I'm a template dialog. I've been opened {{numTemplateOpens}} times! |
| 120 | + |
| 121 | + <p>It's Jazz!</p> |
| 122 | + |
| 123 | + <mat-form-field> |
| 124 | + <mat-label>How much?</mat-label> |
| 125 | + <input matInput #howMuch> |
| 126 | + </mat-form-field> |
| 127 | + |
| 128 | + <p> {{ data.message }} </p> |
| 129 | + <button type="button" (click)="dialogRef.close(howMuch.value)" cdkFocusInitial>Close dialog</button> |
| 130 | + <button (click)="dialogRef.updateSize('500px', '500px').updatePosition({top: '25px', left: '25px'});">Change dimensions</button> |
| 131 | +</ng-template> |
0 commit comments