Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/demo-app/dialog/dialog-demo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, ViewContainerRef} from '@angular/core';
import {Component} from '@angular/core';
import {MdDialog, MdDialogRef} from '@angular/material';

@Component({
Expand All @@ -11,9 +11,7 @@ export class DialogDemo {
dialogRef: MdDialogRef<JazzDialog>;
lastCloseResult: string;

constructor(
public dialog: MdDialog,
public viewContainerRef: ViewContainerRef) { }
constructor(public dialog: MdDialog) { }

open() {
this.dialogRef = this.dialog.open(JazzDialog);
Expand Down
16 changes: 7 additions & 9 deletions src/lib/dialog/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -12,8 +12,9 @@ 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`. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't remove this because it is still an option, but it is optional.

| `disableClose: boolean = false` | Whether to prevent the user from closing a dialog by clicking on the backdrop or pressing escape. Defaults to `false`. |
| `viewContainerRef: ViewContainerRef` | The view container ref to attach the dialog to. Optional. |

## MdDialogRef

Expand All @@ -40,15 +41,12 @@ export class PizzaComponent {

dialogRef: MdDialogRef<PizzaDialog>;

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, {
disableClose: false
});

this.dialogRef.afterClosed().subscribe(result => {
console.log('result: ' + result);
Expand Down