-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ngModel): don't parse before validating if viewValue is undefined #9260
Conversation
@tbosch this should be really quick to review, can you take a quick look? |
|
||
scope.$apply("required = false"); | ||
|
||
expect(inputElm).toBeValid(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this assertion does fail without this change
var parserValid = isUndefined(modelValue) ? undefined : true; | ||
|
||
if (parserValid) { | ||
for(var i = 0; i < ctrl.$parsers.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ii = ctrl.$parsers.length
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no tests, but it's technically possible for the parsers array to grow while a parser is running, so changing that could be a breaking change.
We can do it but it might not be a good commit to do it in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough
LGTM |
thanks, that is one less bug on the checklist \o/ |
Prevents unintentionally reporting an undefined view value as a parse error...
Closes #9106