From e63d4253d06ed7d344358e2c0b03311c548bc978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matias=20Niemel=C3=A4?= Date: Wed, 30 Apr 2014 21:01:47 -0400 Subject: [PATCH] fix(NgModel): make sure the pattern validator uses the $validators pipeline --- src/ng/directive/input.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index cb3eba42..3fe32e8c 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -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