Skip to content

Commit 5547e59

Browse files
committed
fix(ngPattern): Changed pattern to validate against input field value
Set patternDirective validator to test against viewValue instead of modelValue. Closes angular#12344, angular#12618
1 parent dc48aad commit 5547e59

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ng/directive/validators.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ var patternDirective = function() {
4343
ctrl.$validate();
4444
});
4545

46-
ctrl.$validators.pattern = function(value) {
47-
return ctrl.$isEmpty(value) || isUndefined(regexp) || regexp.test(value);
46+
ctrl.$validators.pattern = function(modelValue, viewValue) {
47+
return ctrl.$isEmpty(viewValue) || isUndefined(regexp) || regexp.test(viewValue);
4848
};
4949
}
5050
};

0 commit comments

Comments
 (0)