import { Component , Inject } from '@angular/core' ; import { FormControl , Validators } from '@angular/forms' ; import { MAT_DIALOG_DATA , MatDialogRef } from '@angular/material' ; import { Employee } from '../../employee' ; @ Component ( { selector : 'app-add' , templateUrl : './add-employee.component.html' , styleUrls : [ './add-employee.component.css' ] } ) export class AddEmployeeComponent { formControl = new FormControl ( '' , [ Validators . required ] ) ; readonly genders : string [ ] = [ 'M' , 'F' , 'Other' ] ; constructor ( public dialogRef , @ Inject ( MAT_DIALOG_DATA ) public data ) { } getErrorMessage ( ) { return this . formControl . hasError ( 'required' ) ? 'Required field' : '' ; } onNoClick ( ) { this . dialogRef . close ( ) ; } }