Skip to content

Commit

Permalink
docs(dialog): example of how to inject MdDialogRef (angular#5311)
Browse files Browse the repository at this point in the history
  • Loading branch information
willshowell authored and jelbourn committed Jul 10, 2017
1 parent 1f97945 commit 46d0b6f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/dialog/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ Components created via `MdDialog` can _inject_ `MdDialogRef` and use it to close
in which they are contained. When closing, an optional result value can be provided. This result
value is forwarded as the result of the `afterClosed` promise.

```ts
@Component({/* ... */})
export class YourDialog {
constructor(public dialogRef: MdDialogRef<YourDialog>) { }

closeDialog() {
this.dialogRef.close('Pizza!');
}
}
```

### Sharing data with the Dialog component.
If you want to share data with your dialog, you can use the `data` option to pass information to the dialog component.

Expand Down

0 comments on commit 46d0b6f

Please sign in to comment.