meteorjs 中没有选择文件时如何禁用上传按钮?
How to disable upload button when there is no file selected in meteorjs?
我试过 slideForm.$invalid
,但不是 working.Can 你建议最好的方法?
<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>
我想你必须像这样把它作为必填字段
<input type="file" name="file" fileread="vm.file" class="form-control" ng-model="vm.file" required>
我试过 slideForm.$invalid
,但不是 working.Can 你建议最好的方法?
<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>
我想你必须像这样把它作为必填字段
<input type="file" name="file" fileread="vm.file" class="form-control" ng-model="vm.file" required>