1export interface DialogData {
2 animal: 'panda' | 'unicorn' | 'lion';
3}
4...
5export class DialogDataExample {
6 constructor(public dialog: MatDialog) {}
7
8 openDialog() {
9 this.dialog.open(DialogDataExampleDialog, {
10 data: {
11 animal: 'panda'
12 }
13 });
14 }
15}
16
17@Component({
18 selector: 'dialog-data-example-dialog',
19 templateUrl: 'dialog-data-example-dialog.html',
20})
21export class DialogDataExampleDialog {
22 constructor(@Inject(MAT_DIALOG_DATA) public data: DialogData) {}
23}