From 78508e35ca4fc10dd157866e1e1a1a94d7e2c6d4 Mon Sep 17 00:00:00 2001 From: melbourne2991 Date: Wed, 25 Nov 2015 22:49:10 +1100 Subject: [PATCH] docs(input): ngPatter validates against view value ngPattern doesn't validate model value any more, it validates the viewValue. I think it's worth mentioning explicitly, I was removing whitespace in a $parser but because the parser was modifying the modelValue and not the viewValue the pattern was coming up invalid - reading the docs I made the assumption that the ng pattern was reading the modelValue, it was only until I dug into angular's source I realised this wasn't the case. https://github.com/angular/angular.js/pull/12640/files#diff-fd9d2cc2d19609321aa0bd5cfa6b3444R46 --- src/ng/directive/input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index afd2391d1cab..c0ddede2ddde 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -1549,7 +1549,7 @@ function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filt * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any * length. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match + * @param {string=} ngPattern Sets `pattern` validation error key if the view value does not match * a RegExp found by evaluating the Angular expression given in the attribute value. * If the expression evaluates to a RegExp object, then this is used directly. * If the expression evaluates to a string, then it will be converted to a RegExp