Skip to content

Commit 46d0b6f

Browse files
willshowelljelbourn
authored andcommitted
docs(dialog): example of how to inject MdDialogRef (#5311)
1 parent 1f97945 commit 46d0b6f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/lib/dialog/dialog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ Components created via `MdDialog` can _inject_ `MdDialogRef` and use it to close
2929
in which they are contained. When closing, an optional result value can be provided. This result
3030
value is forwarded as the result of the `afterClosed` promise.
3131

32+
```ts
33+
@Component({/* ... */})
34+
export class YourDialog {
35+
constructor(public dialogRef: MdDialogRef<YourDialog>) { }
36+
37+
closeDialog() {
38+
this.dialogRef.close('Pizza!');
39+
}
40+
}
41+
```
42+
3243
### Sharing data with the Dialog component.
3344
If you want to share data with your dialog, you can use the `data` option to pass information to the dialog component.
3445

0 commit comments

Comments
 (0)