import { Component , Inject , OnInit , ViewEncapsulation } from '@angular/core' ; import { MAT_DIALOG_DATA , MatDialogRef } from '@angular/material' ; @ Component ( { selector : 'app-test' , templateUrl : './test.component.html' , styleUrls : [ './test.component.scss' ] , encapsulation : ViewEncapsulation . None } ) export class TestComponent implements OnInit { constructor ( private matDialogRef , @ Inject ( MAT_DIALOG_DATA ) public data ) { } ngOnInit ( ) { } public close ( ) { this . matDialogRef . close ( ) ; } }