I need one help.I have my file/image path in my DB.When i needed to update i retrieved that path and wanted to set in that image/file tag for display.I am explaining my code below.
<div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-right" style="width:180px">Upload Image :</span>
<input type="file" class="filestyle form-control" data-size="lg" name="uploadme" id="bannerimage" ng-model="file" ngf-pattern="'image/*'" accept="image/*" ngf-max-size="20MB" ngf-min-height="100" ngf-resize="{width: 100, height: 100}" custom-on-change="uploadFile" required="required" ngf-select="onFileSelect($file);" ng-readonly="imageread" ng-disabled="imagedis">
</div>
<div class="input-group bmargindiv1 text-right col-md-12" ng-show="showImage">
<img ng-src="{{attchImage}}" name="pro" border="0" style="width:50px; height:50px; border:#808080 1px solid;" />
</div>
The part is my HTML part of Image tag.My controller side code is given below.
$scope.showImage=true;
$scope.attchImage="upload/"+response.data[0].image;
Here i am setting the image name with path for display purpose. But i have below common validation for both add and update case.
if(billdata.uploadme.$invalid){
alert('Please select the proper image');
productInpuFieldFocus.borderColor('bannerimage');
}
Here my problem is even if its not mandatory to update image again in update
case still it is showing the validation error message. But here i need in Add
case this error will be checked and in update
it will not check so i need to add that file name in image tag and file input tag.Please help me.