From 9aa50df8bda288576eaea3d272eab203686dbc4d Mon Sep 17 00:00:00 2001 From: Emilio Martinez-Cordero Date: Tue, 3 Oct 2017 03:02:28 -0700 Subject: [PATCH] demo(dialog): address AOT issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Appeases the AOT type checker for the template by extending `MatDialogConfig` to disallow `position` from being undefined, given that it’s optional. Guards cannot be set on the template because the values are bound to NgModel. --- src/demo-app/dialog/dialog-demo.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/demo-app/dialog/dialog-demo.ts b/src/demo-app/dialog/dialog-demo.ts index 05f29786bda2..c7c979202f83 100644 --- a/src/demo-app/dialog/dialog-demo.ts +++ b/src/demo-app/dialog/dialog-demo.ts @@ -1,7 +1,21 @@ import {Component, Inject, ViewChild, TemplateRef} from '@angular/core'; import {DOCUMENT} from '@angular/platform-browser'; -import {MatDialog, MatDialogConfig, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material'; - +import { + DialogPosition, + MatDialog, + MatDialogConfig, + MatDialogRef, + MAT_DIALOG_DATA +} from '@angular/material'; + +/** + * Appeases the AOT type checker for the template by extending `MatDialogConfig` + * to disallow `position` from being undefined, given that it’s optional. + * Guards cannot be set on the template because the values are bound to NgModel. + */ +interface MatDemoDialogConfig extends MatDialogConfig { + position: DialogPosition; +} @Component({ moduleId: module.id, @@ -14,7 +28,7 @@ export class DialogDemo { lastAfterClosedResult: string; lastBeforeCloseResult: string; actionsAlignment: string; - config: Partial = { + config: MatDemoDialogConfig = { disableClose: false, panelClass: 'custom-overlay-pane-class', hasBackdrop: true,