0

我试过了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>
4

1 回答 1

0

我认为您必须像这样将其设置为必填字段

<input type="file" name="file" fileread="vm.file" class="form-control" ng-model="vm.file" required>
于 2017-08-10T06:50:54.463 回答