Angularjs 在js中提交表单时验证文件上载
我需要验证我的文件上传,并显示错误消息,如果用户点击提交没有上传任何文件。我的代码是Angularjs 在js中提交表单时验证文件上载,angularjs,forms,validation,file-upload,Angularjs,Forms,Validation,File Upload,我需要验证我的文件上传,并显示错误消息,如果用户点击提交没有上传任何文件。我的代码是 <div class=" form-label form-label-responsive col-sm-4 text-right" ><span>Upload a file</span></div> <div class="form-group col-sm-6" ng-class="{{(_DominoForm['%%File.ca257e9d0005
<div class=" form-label form-label-responsive col-sm-4 text-right" ><span>Upload a file</span></div>
<div class="form-group col-sm-6" ng-class="{{(_DominoForm['%%File.ca257e9d000513c5.c758deaebd88bc7fca257ea40005f6fe.$Body.0.70'].$invalid)? 'has-error' : 'has-success'}}">
<input class= "form-control form-input" data-file id="%%File.ca257e9d000513c5.c758deaebd88bc7fca257ea40005f6fe.$Body.0.70" name="%%File.ca257e9d000513c5.c758deaebd88bc7fca257ea40005f6fe.$Body.0.70" ng-model="my_file_model" type="file"
required="true">
<p ng-show="_DominoForm['%%File.ca257e9d000513c5.c758deaebd88bc7fca257ea40005f6fe.$Body.0.70'].$error.required ">
<span class="icon icon-size-sm icon-alert" aria-labelledby="error-text"></span>
<span class="ng-binding"> Please select a file </span>
</p>
上传文件
请选择一个文件
我的表单名是_DominoForm。我不知道我做错了什么。
单击“提交”时不会显示任何错误。
任何帮助都将不胜感激