whole_func_string: function() {
      // ignore $validate before model is initialized
      if (isNumberNaN(this.$modelValue)) {
        return;
      }
  
      var viewValue = this.$$lastCommittedViewValue;
      // Note: we use the $$rawModelValue as $modelValue might have been
      // set to undefined during a view -> model update that found validation
      // errors. We can't parse the view here, since that could change
      // the model although neither viewValue nor the model on the scope changed
      var modelValue = this.$$rawModelValue;
  
      var prevValid = this.$valid;
      var prevModelValue = this.$modelValue;
  
      var allowInvalid = this.$options.getOption('allowInvalid');
  
      var that = this;
      this.$$runValidators(modelValue, viewValue, function(allValid) {
        // If there was no change in validity, don't update the model
        // This prevents changing an invalid modelValue to undefined
        if (!allowInvalid && prevValid !== allValid) {
          // Note: Don't check this.$valid here, as we could have
          // external validators (e.g. calculated on the server),
          // that just call $setValidity and need the model value
          // to calculate their validity.
          that.$modelValue = allValid ? modelValue : undefined;
  
          if (that.$modelValue !== prevModelValue) {
            that.$$writeModelToScope();
          }
        }
      });
    }
func_code_string: function() {
      // ignore $validate before model is initialized
      if (isNumberNaN(this.$modelValue)) {
        return;
      }
  
      var viewValue = this.$$lastCommittedViewValue;
      // Note: we use the $$rawModelValue as $modelValue might have been
      // set to undefined during a view -> model update that found validation
      // errors. We can't parse the view here, since that could change
      // the model although neither viewValue nor the model on the scope changed
      var modelValue = this.$$rawModelValue;
  
      var prevValid = this.$valid;
      var prevModelValue = this.$modelValue;
  
      var allowInvalid = this.$options.getOption('allowInvalid');
  
      var that = this;
      this.$$runValidators(modelValue, viewValue, function(allValid) {
        // If there was no change in validity, don't update the model
        // This prevents changing an invalid modelValue to undefined
        if (!allowInvalid && prevValid !== allValid) {
          // Note: Don't check this.$valid here, as we could have
          // external validators (e.g. calculated on the server),
          // that just call $setValidity and need the model value
          // to calculate their validity.
          that.$modelValue = allValid ? modelValue : undefined;
  
          if (that.$modelValue !== prevModelValue) {
            that.$$writeModelToScope();
          }
        }
      });
    }
func_documentation_string: @ngdoc method
  @name ngModel.NgModelController#$validate
  
  @description
  Runs each of the registered validators (first synchronous validators and then
  asynchronous validators).
  If the validity changes to invalid, the model will be set to `undefined`,
  unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.
  If the validity changes to valid, it will set the model to the last available valid
  `$modelValue`, i.e. either the last parsed value or the last value set from the scope.