ng2-validation-manager icon indicating copy to clipboard operation
ng2-validation-manager copied to clipboard

Image validation is not working

Open ghost opened this issue 7 years ago • 0 comments

i have used ng2 validation manager. I want to validate image.

My html file like below

    <input type="file" (change)="fileChangeEvent($event)" class="form-control" formControlName="filesToUpload">

and my ts file as below

filesToUpload: Array<File> = []; this.form1 = new ValidationManager({ 'filesToUpload' : 'required', }); fileChangeEvent(fileInput: any) { this.filesToUpload = <Array<File>>fileInput.target.files; }

save1(){ console.log(this.form1.getData()); if(this.form1.isValid()){ alert('validation pass'); console.log(this.form1.getData()); this.form1.reset(); // this.myModal.close(); //this.myModal.close() }else{ alert('validation failed'); } }

When i submit my button i get only 'validation failed' in alert message.how can i validate image also i want to validate whether the selected file is image or not?

ghost avatar Feb 15 '18 09:02 ghost