Join the Stack Overflow Community
Stack Overflow is a community of 6.8 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I need one help.I want to validate input type=file field using Angular.js.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="bannerimage" id="bannerimage" ngf-select ng-model="file" ngf-pattern="'image/*'" accept="image/*" ngf-max-size="20MB" ngf-min-height="100" ngf-resize="{width: 100, height: 100}" >
</div>

<input type="button" class="btn btn-success" ng-click="addProductInfoData();"  id="addProfileData" ng-value="buttonName"/>

Here i am using angular.js ngFileUpload module.My requirement is when user will forget to select image and click on Add button one alert message will notify user to select image. Please help me to do this.

share|improve this question
    
How about if (form.file.$valid && $scope.file) ? – Rayon Dec 4 '15 at 11:54
    
I will check and inform you. – satya Dec 4 '15 at 11:55
    
No,Its not checking. – satya Dec 4 '15 at 11:58
    
Have you make basic changes like name of the field and model name ? – Rayon Dec 4 '15 at 12:00
    
What i did,I put console message like console.log('valid',billdata.bannerimage.$invalid); but it gave me false when file input is blank. – satya Dec 4 '15 at 12:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.