ngModel.NgModelController.$validators

$validators

Object.<string, function>

A collection of validators that are applied whenever the model value changes. The key value within the object refers to the name of the validator while the function refers to the validation operation. The validation operation is provided with the model value as an argument and must return a true or false value depending on the response of that validation.

ngModel.$validators.validCharacters = function(modelValue, viewValue) {
  var value = modelValue || viewValue;
  return /[0-9]+/.test(value) &&
         /[a-z]+/.test(value) &&
         /[A-Z]+/.test(value) &&
         /\W+/.test(value);
};
doc_AngularJS
2016-03-29 16:12:17
Comments
Leave a Comment

Please login to continue.