Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(NgModel): make sure the pattern validator uses the $validators pi…
Browse files Browse the repository at this point in the history
…peline
  • Loading branch information
matsko committed Jun 13, 2014
1 parent e53554a commit e63d425
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/ng/directive/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -996,12 +996,9 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
regexp = regex || undefined;
});

var patternValidator = function(value) {
return validate(ctrl, 'pattern', ctrl.$isEmpty(value) || isUndefined(regexp) || regexp.test(value), value);
ctrl.$validators.pattern = function(value) {
return ctrl.$isEmpty(value) || isUndefined(regexp) || regexp.test(value);
};

ctrl.$formatters.push(patternValidator);
ctrl.$parsers.push(patternValidator);
}

// min length validator
Expand Down

0 comments on commit e63d425

Please sign in to comment.