diff --git a/src/dev-app/dialog/BUILD.bazel b/src/dev-app/dialog/BUILD.bazel index 76562e584e7b..4ac85446bef2 100644 --- a/src/dev-app/dialog/BUILD.bazel +++ b/src/dev-app/dialog/BUILD.bazel @@ -18,6 +18,7 @@ ng_module( "//src/material/form-field", "//src/material/input", "//src/material/select", + "//src/material/snack-bar", ], ) diff --git a/src/dev-app/dialog/dialog-demo.html b/src/dev-app/dialog/dialog-demo.html index 5a00217091ca..e56b260950bf 100644 --- a/src/dev-app/dialog/dialog-demo.html +++ b/src/dev-app/dialog/dialog-demo.html @@ -146,4 +146,6 @@

Other options

class="demo-dialog-button"> Change dimensions + + diff --git a/src/dev-app/dialog/dialog-demo.ts b/src/dev-app/dialog/dialog-demo.ts index aab8a6680829..07391e69eec1 100644 --- a/src/dev-app/dialog/dialog-demo.ts +++ b/src/dev-app/dialog/dialog-demo.ts @@ -23,6 +23,7 @@ import {MatFormFieldModule} from '@angular/material/form-field'; import {MatInputModule} from '@angular/material/input'; import {MatSelectModule} from '@angular/material/select'; import {DragDropModule} from '@angular/cdk/drag-drop'; +import {MatSnackBar, MatSnackBarModule} from '@angular/material/snack-bar'; const defaultDialogConfig = new MatDialogConfig(); @@ -43,6 +44,7 @@ const defaultDialogConfig = new MatDialogConfig(); MatFormFieldModule, MatInputModule, MatSelectModule, + MatSnackBarModule, ], }) export class DialogDemo { @@ -76,7 +78,11 @@ export class DialogDemo { @ViewChild(TemplateRef) template: TemplateRef; - constructor(public dialog: MatDialog, @Inject(DOCUMENT) doc: any) { + constructor( + public dialog: MatDialog, + public snackbar: MatSnackBar, + @Inject(DOCUMENT) doc: any, + ) { // Possible useful example for the open and closeAll events. // Adding a class to the body if a dialog opens and // removing it after all open dialogs are closed @@ -112,6 +118,10 @@ export class DialogDemo { this.dialog.open(this.template, this._getDialogConfig()); } + openSnackbar() { + this.snackbar.open('Hello from Dialog'); + } + private _getDialogConfig(): MatDialogConfig { const config = {...this.config}; if (this.enableLegacyPadding) {