Javascript ng文件上载验证规则不';t run和form在所有情况下都返回$valid:true

Javascript ng文件上载验证规则不';t run和form在所有情况下都返回$valid:true,javascript,angularjs,ng-file-upload,Javascript,Angularjs,Ng File Upload,我有一个场景,需要为数组中的每个对象生成一个上载表单。我正在使用来处理上传和表单验证 问题是验证在我的本地机器上工作得很好,但在服务器上部署时不会触发验证 我已经绝对确保没有部署错误,在多个浏览器中测试,清除缓存,等等。代码是100%相同的。只有结果因任何原因而不同 提交表单后,在DevTools中查看表单元素$scope,您可以看到$valid和各种验证器都存在并设置为true,但当验证失败时,不会将它们切换为false: 文件:对象{ $asyncValidators:对象 $dirty:对

我有一个场景,需要为数组中的每个对象生成一个上载表单。我正在使用来处理上传和表单验证

问题是验证在我的本地机器上工作得很好,但在服务器上部署时不会触发验证

我已经绝对确保没有部署错误,在多个浏览器中测试,清除缓存,等等。代码是100%相同的。只有结果因任何原因而不同

提交表单后,在DevTools中查看表单元素
$scope
,您可以看到
$valid
和各种验证器都存在并设置为
true
,但当验证失败时,不会将它们切换为
false

文件:对象{
$asyncValidators:对象
$dirty:对
$error:Object
$invalid:false
$name:“文件”
$ngfValidations:数组[11]
$pending:未定义
$pristine:错
美元:错
$untouched:真的
$valid:true
}

这是视图中的代码(稍微简化):


单击或拖动以选择图像和视频

媒体必须为{point.endpoint.format.width}}×;{{point.endpoint.format.height}}px 最大上载大小超出了允许的最大大小200MB 此终结点仅允许{{point.endpoint.type.acceptedFormat.join(',')}上载 您的视频超过了允许的最大时间{{point.timeslots*15}}秒。
正如我提到的:代码在我的本地机器上100%工作,但是表单在服务器上运行时不会运行验证


非常感谢您的帮助。

打印uploadForm.file的内容。$选择文件后出现错误,可能会给您提供线索。@danial已经尝试过了。就好像验证没有运行一样$错误对象保持为空,$valid保持为真。我想这可能与ng repeat和表单范围有关。如果我找到了解决方案,我会发布我的答案。可以只使用一个端点进行尝试,看看这是否会有所不同
<div ng-repeat="point in endpoints">
    <div class="panel-body" >
        <form name="uploadForm">
            <div class="media-uploader button drop-box"
                ng-model="file"
                name="file"
                ngf-drag-over-class="'dragover'"
                ngf-accept="{{point.endpoint.type.acceptedFormat.join('/*,') }}/*"
                ngf-select="uploadForm.$valid && submitUpload($file, point)"
                ngf-drop="submitUpload($file, point)"
                ngf-max-size="{{ maxFileUploadSize }}"
                ngf-pattern="{{ point.endpoint.type.acceptedFormat.join('/*,') }}/*"
                ngf-max-duration="{{ (point.timeslots * 15)+tolerance }}"
                ngf-validate = "{width: {min: {{ point.endpoint.format.width }}, max:{{ point.endpoint.format.width }}},
                                height: {min: {{ point.endpoint.format.height }}, max: {{ point.endpoint.format.height }}}
                                }">

                <p>Click or drag to select images and video</p>
            </div>
         </form>
         <div class="has-error" >
             <div ng-show="uploadForm.file.$error.maxHeight || uploadForm.file.$error.maxWidth ">
                 Media must be {{ point.endpoint.format.width }} &times; {{ point.endpoint.format.height }}px
             </div>
             <div ng-show="uploadForm.file.$error.maxSize">
                 Max upload size exceeded the maximum allowed size is 200MB
             </div>
             <div ng-show="uploadForm.file.$error.pattern ">
                 This endpoint only allows {{ point.endpoint.type.acceptedFormat.join(', ') }} uploads
             </div>
             <div ng-show="uploadForm.file.$error.maxDuration ">
                 Your video exceeds the maximum allowed time of {{ point.timeslots * 15 }} seconds.
             </div>
         </div>
     </div>
</div>