diff --git a/src/demo-app/dialog/dialog-demo.ts b/src/demo-app/dialog/dialog-demo.ts index 1cb56c988b3f..5935059be7c8 100644 --- a/src/demo-app/dialog/dialog-demo.ts +++ b/src/demo-app/dialog/dialog-demo.ts @@ -1,4 +1,4 @@ -import {Component, ViewContainerRef} from '@angular/core'; +import {Component} from '@angular/core'; import {MdDialog, MdDialogRef} from '@angular/material'; @Component({ @@ -11,9 +11,7 @@ export class DialogDemo { dialogRef: MdDialogRef; lastCloseResult: string; - constructor( - public dialog: MdDialog, - public viewContainerRef: ViewContainerRef) { } + constructor(public dialog: MdDialog) { } open() { this.dialogRef = this.dialog.open(JazzDialog); diff --git a/src/lib/dialog/README.md b/src/lib/dialog/README.md index 8634a3b5b38e..f3fff4685243 100644 --- a/src/lib/dialog/README.md +++ b/src/lib/dialog/README.md @@ -1,6 +1,6 @@ # MdDialog -MdDialog is a service, which opens dialogs components in the view. +MdDialog is a service, which opens dialogs components in the view. ### Methods @@ -12,8 +12,8 @@ MdDialog is a service, which opens dialogs components in the view. | Key | Description | | --- | --- | -| `viewContainerRef: ViewContainerRef` | The view container ref to attach the dialog to. | | `role: DialogRole = 'dialog'` | The ARIA role of the dialog element. Possible values are `dialog` and `alertdialog`. Defaults to `dialog`. | +| `disableClose: boolean = false` | Whether to prevent the user from closing a dialog by clicking on the backdrop or pressing escape. Defaults to `false`. | ## MdDialogRef @@ -40,15 +40,12 @@ export class PizzaComponent { dialogRef: MdDialogRef; - constructor( - public dialog: MdDialog, - public viewContainerRef: ViewContainerRef) { } + constructor(public dialog: MdDialog) { } openDialog() { - let config = new MdDialogConfig(); - config.viewContainerRef = this.viewContainerRef; - - this.dialogRef = this.dialog.open(PizzaDialog, config); + this.dialogRef = this.dialog.open(PizzaDialog, { + role: 'alertdialog' + }); this.dialogRef.afterClosed().subscribe(result => { console.log('result: ' + result);