import { Component , OnInit , Inject } from '@angular/core' ; import { MatDialogRef , MAT_DIALOG_DATA } from '@angular/material/dialog' ; import { FormGroup , FormBuilder , Validators , FormControl } from '@angular/forms' ; @ Component ( { selector : 'mifosx-loan-account-load-documents-dialog' , templateUrl : './loan-account-load-documents-dialog.component.html' , styleUrls : [ './loan-account-load-documents-dialog.component.scss' ] } ) export class LoanAccountLoadDocumentsDialogComponent implements OnInit { /** Upload Document form. */ uploadDocumentForm : FormGroup ; param { MatDialogRef } dialogRef param { FormBuilder } formBuilder param { any } data constructor ( public dialogRef , private formBuilder , @ Inject ( MAT_DIALOG_DATA ) public data ) { } ngOnInit ( ) { this . createUploadDocumentForm ( ) ; } /**
     * Creates the upload Document form.
     */ createUploadDocumentForm ( ) { this . uploadDocumentForm = this . formBuilder . group ( { 'name' : [ '' , Validators . required ] , 'description' : [ '' ] , 'file' : [ '' ] } ) ; } param { any } $event onFileSelect ( $event ) { if ( $event . target . files . length > 0 ) { const file = $event . target . files [ 0 ] ; this . uploadDocumentForm . get ( 'file' ) . setValue ( file ) ; } } }