Skip to content

Commit

Permalink
docs(dialog): add new option and update example
Browse files Browse the repository at this point in the history
* Mentions the `disableClose` option in the readme.
* Updates the dialog readme and dialog demo not to use the `viewContainerRef` since it's not necessary anymore.
  • Loading branch information
crisbeto committed Nov 10, 2016
1 parent 547a75d commit 7916f34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
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
15 changes: 6 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,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

Expand All @@ -40,15 +40,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, {
role: 'alertdialog'
});

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

0 comments on commit 7916f34

Please sign in to comment.