angularjs - How to use ng-required with input type as file? -
i have form in angularjs image(logo) needs compulsory upload when particular check box checked,and if checkbox not selected user may upload image in case it's not compulsory. tried using ng-required conditional required functionality it's not working file input.
html
<input type="checkbox" ng-model="istrue" ng-change="ischecked()"/>
controller.js
$scope.check = false; $scope.ischecked = function() { $scope.check = true; }
html
<input id="uploadfile" placeholder="choose file" ng-model="uploadfile" ng-required="check" />
may anyone. in advance.
i wanted file upload functionality , did follows.
hope helps.
<form id="uploader" ng-submit="uploadimage()" role="form"> <input id="image" type="file" required /> <input type="submit" value="upload" class="button btn-success form-control" /> <input type="reset" name="reset" value="reset" class="button btn-danger form-control" /> </form>
this ensured me on selecting file(image) in order user submit.
Comments
Post a Comment