From 5547e5941d86d6a2301d4595d239580aa6578477 Mon Sep 17 00:00:00 2001 From: kacecode Date: Thu, 20 Aug 2015 03:26:49 -0600 Subject: [PATCH] fix(ngPattern): Changed pattern to validate against input field value Set patternDirective validator to test against viewValue instead of modelValue. Closes #12344, #12618 --- src/ng/directive/validators.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ng/directive/validators.js b/src/ng/directive/validators.js index ef7650f10ceb..9ae954d1ddbf 100644 --- a/src/ng/directive/validators.js +++ b/src/ng/directive/validators.js @@ -43,8 +43,8 @@ var patternDirective = function() { ctrl.$validate(); }); - ctrl.$validators.pattern = function(value) { - return ctrl.$isEmpty(value) || isUndefined(regexp) || regexp.test(value); + ctrl.$validators.pattern = function(modelValue, viewValue) { + return ctrl.$isEmpty(viewValue) || isUndefined(regexp) || regexp.test(viewValue); }; } };