I have the following directive:
.directive('validateCPF', function () {
return {
require: 'ngModel',
link: function (scope, element, attrs, ctrl) {
ctrl.$validators.cpf = function (modelValue, viewValue) {
console.log('chamou directiva');
var validatorCPF = new CPF();
return (validatorCPF.valida(viewValue));
};
}
};
});
This directive uses an external lib to validate cpf
, but does not even reach console.log
.
My form:
<input id="cpf" class="col-xs-12 cpf" type="text" name="cpf" ng-model="cau.cpf" validate-CPF >
Angular VersionJS 1.4