https://i.sstatic.net/HUgeT.png
Utilizing an angular image upload plugin, I am aiming to display an error message for ngf-pattern
when a user uploads an invalid file type. However, there is another error message being displayed (ng-required message). How can I prevent the ng-required
message from showing up? The validation process is carried out using the Angular-auto-validate plugin.
Here is my code:
<div class="col-sm-6">
<input type="file" ngf-select ng-model="file.nicCopy" name="nicCopy" ngf-pattern="'.jpg,.jpeg,.png'" ngf-accept="'image/*'" ngf-max-size="20MB" ngf-min-height="100" ng-required="!customerDetails.isPending && (customerDetails.customerType.description | uppercase) == 'INDIVIDUAL' && (!customerDetails.filepathnic || customerDetails.filepathnic == 'null')" ngf-resize="{width: 800, height: 600}" ngf-resize-if="$width > 800 || $height > 600" class="form-control" />
<img ngf-thumbnail="file.nicCopy" ngf-size="{width: 100, height: 100, quality: 0.9} ">
<div ng-if="customerForm.nicCopy.$error.pattern" class="error-msg">Invalid File Format </div>
</div>