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

Multiple problems with $validate after a validator changes #7836

Closed
shahata opened this issue Jun 14, 2014 · 0 comments
Closed

Multiple problems with $validate after a validator changes #7836

shahata opened this issue Jun 14, 2014 · 0 comments

Comments

@shahata
Copy link
Contributor

shahata commented Jun 14, 2014

See example at: http://plnkr.co/edit/i320YT1EX8Dmst6m7dVM?p=preview

  1. value always becomes valid if $validate is invoked while the value is invalid: enter max=5, value=123456 => change max to be 3 => value is now valid.
  2. model remains undefined even after $validate validators are now valid: enter max=5, value=123456 => change max to be 9 => value is still undefined.
  3. model does not become undefined even after $validate validators are now invalid: max=9, value=123456 => change max to be 5 => value is still 123456
ckknight pushed a commit to ckknight/angular.js that referenced this issue Jul 16, 2014
If `$validate` is invoked when the model is already invalid, `$validate`
should pass `$$invalidModelValue` to the validators, not `$modelValue`.

Moreover, if `$validate` is invoked and it is found that the invalid model
has become valid, this previously invalid model should be assigned to
`$modelValue`.

Lastly, if `$validate` is invoked and it is found that the model has
become invalid, the previously valid model should be assigned to
`$$invalidModelValue`.

Closes angular#7836
Closes angular#7837
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant