Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix(input): don't perform HTML5 validation on updated model-value #6806

Closed
wants to merge 1 commit into from

Conversation

caitp
Copy link
Contributor

@caitp caitp commented Mar 23, 2014

Running html5-validation immediately after model-value is updated is incorrect, because the view has not updated, and HTML5 constraint validation has not adjusted. This should be properly fixed later on by performing html5 validation after the view value is updated, and a comment has been left to address this in the future.

Closes #6796

@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#6806)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@park9140
Copy link

Thanks @caitp 👍

Running html5-validation immediately after model-value is updated is incorrect, because the view
has not updated, and HTML5 constraint validation has not adjusted.

Closes angular#6796
@caitp
Copy link
Contributor Author

caitp commented Mar 23, 2014

@park9140 can you test and make sure it works? Unfortunately constraint validation is basically impossible to write unit tests for, and integration tests didn't work either :( Hopefully we can fix this down the line, but yeah, if you can do that, that would help.

@park9140
Copy link

@caitp, done I tried it with a few different types and they seem fine now that the filter is removed.

plunker w/ issue-6796 angular:
http://plnkr.co/edit/wvEELzO6QVjmptM56a58?p=preview

@caitp
Copy link
Contributor Author

caitp commented Mar 23, 2014

thanks, I'll try to get this merged on monday or tuesday. If you're using this in a production app, the patch is pretty simple, so you should be okay there

@petebacondarwin
Copy link
Member

LGTM.

I know it is historically the norm, but I am not convinced that validators should be added to $formatters in any case! The whole concept of validity in Angular forms is a bit vague. E.g. We can set the $modelValue to something that is invalid but it won't update the $viewValue.

@caitp caitp closed this in b472d02 Mar 24, 2014
caitp added a commit that referenced this pull request Mar 24, 2014
Running html5-validation immediately after model-value is updated is incorrect, because the view
has not updated, and HTML5 constraint validation has not adjusted.

Closes #6796
Closes #6806
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG - Html5 Validators are executed on model value change
4 participants