mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-09 09:00:34 +08:00
fix(NgModel): make sure the pattern validator uses the $validators pipeline
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user