Angularjs 禁用angular中的验证,直到下载模型的ajax请求完成

Angularjs 禁用angular中的验证,直到下载模型的ajax请求完成,angularjs,validation,client-side-validation,Angularjs,Validation,Client Side Validation,您好,当ajax请求从服务器下载模型时,有没有一种简单的方法来禁用验证 假设我有这个输入 <input type="text" class="form-control" id="FieldName" name="FieldName" ng-model="model.thefield" required ng-maxlength="100"> 因此,在请求完成之前,输入无效: $http.get('/some/url') .then(function (response)

您好,当ajax请求从服务器下载模型时,有没有一种简单的方法来禁用验证

假设我有这个输入

<input type="text" class="form-control" id="FieldName" name="FieldName"
  ng-model="model.thefield" required ng-maxlength="100">
因此,在请求完成之前,输入无效:

$http.get('/some/url')
    .then(function (response) {
        $scope.model = response.data;
    });
是否有方法在该请求完成之前禁用验证。目前,我最初将模型设置为有效值。例如:

$scope.model = {
    thefield: "loading"
}

您可以尝试将
required
更改为
ng required=“yourBool”
,然后编写

$http.get('/some/url')
  .then(function (response) {
    $scope.yourBool = true;
    $scope.model = response.data;
  });

“禁用验证”是什么意思?是否要停止验证,以便在请求完成之前,
required
ng maxlength
不起作用?或者,您希望验证输入字段,直到请求完成,之后不应验证输入?“是否要停止验证,以便在请求完成之前required和ng maxlength不起作用?”此选项。
$http.get('/some/url')
  .then(function (response) {
    $scope.yourBool = true;
    $scope.model = response.data;
  });