function validate(ctrl, validatorName, validity, value){
  ctrl.$setValidity(validatorName, validity);
  return validity ? value : undefined;
}
function validate(ctrl, validatorName, validity, value){
  ctrl.$setValidity(validatorName, validity);
  return validity ? value : undefined;
}
function validate ( ctrl , validatorName , validity , value ) { ctrl . $setValidity ( validatorName , validity ) ; return validity ? value : undefined ; }
A helper function to call $setValidity and return the value / undefined, a pattern that is repeated a lot in the input validation logic.
A helper function to call $setValidity and return the value / undefined a pattern that is repeated a lot in the input validation logic .