import { Component , Inject , OnInit , ViewChild } from '@angular/core' ; import { MAT_DIALOG_DATA , MatDialogRef } from '@angular/material' ; import { FreeTextUnitEditorComponent } from '../free-text-unit-editor.component' ; @ Component ( { selector : 'app-free-text-unit-editor-dialog' , templateUrl : './free-text-unit-editor.dialog.html' , styleUrls : [ './free-text-unit-editor.dialog.scss' ] } ) export class FreeTextUnitEditorDialog implements OnInit { @ ViewChild ( FreeTextUnitEditorComponent ) public freeTextEditor : FreeTextUnitEditorComponent ; constructor ( public dialogRef , @ Inject ( MAT_DIALOG_DATA ) public data ) { } ngOnInit ( ) { this . dialogRef . beforeClose ( ) . subscribe ( data => { this . dialogRef . close ( this . freeTextEditor . unitForm . controls . markdown . value ) ; } ) ; } onCloseClick ( ) { return this . dialogRef . close ( this . freeTextEditor . unitForm . controls . markdown . value ) ; } }