我曾尝试slideForm.$invalid
,但它无法正常工作。您能建议最好的方法吗?
<form name="slideForm">
<div class="aboutFile">
<input type="file" name="file" fileread="vm.file" class="form-control" ng-model="vm.file">
<div class="create-component--perma-bg">
<i class="fa fa-plus-square-o" aria-hidden="true"></i>
<span ng-if="!vm.file.name">Add File </span>
<span ng-if="vm.file.name">{{vm.file.name}}</span>
</div>
<button type="button" class="btn btn-info bgChangeBtnInfo" ng-
click="vm.upload(vm.file)" ng-disabled="slideForm.$invalid">
Upload</button>
</div>
</form>
答案 0 :(得分:0)
我认为你必须按照这个要求字段
<input type="file" name="file" fileread="vm.file" class="form-control" ng-model="vm.file" required>