import { Component , Inject } from '@angular/core' ; import { MatDialog , MAT_DIALOG_DATA } from '@angular/material' ; export interface DialogData { animal : 'panda' | 'unicorn' | 'lion' ; } title @ Component ( { selector : 'dialog-data-example' , templateUrl : 'dialog-data-example.html' , styleUrls : [ 'dialog-data-example.css' ] , } ) export class DialogDataExample { constructor ( public dialog ) { } openDialog ( ) { this . dialog . open ( DialogDataExampleDialog , { data : { animal : 'panda' } } ) ; } } @ Component ( { selector : 'dialog-data-example-dialog' , templateUrl : 'dialog-data-example-dialog.html' , } ) export class DialogDataExampleDialog { constructor ( @ Inject ( MAT_DIALOG_DATA ) public data ) { } }