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

$setViewValue revalidate parameter #8481

Closed
dimirc opened this issue Aug 5, 2014 · 4 comments
Closed

$setViewValue revalidate parameter #8481

dimirc opened this issue Aug 5, 2014 · 4 comments

Comments

@dimirc
Copy link
Contributor

dimirc commented Aug 5, 2014

I see that $setViewValue has a third parameter (revalidate) that I'm setting to true to force $parsers to run and recreate $modelValue

this.$setViewValue = function(value, trigger, revalidate) {
https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js#L1928

At the docs I don't see this third parameter documented, is it save to use it?

I'm using it on this PR angular-ui/ui-select#138

@caitp
Copy link
Contributor

caitp commented Aug 20, 2014

This (the revalidate parameter) is a private API which is going to be removed soon, most likely. It was added as a hack to make sure that the native validators would be re-run even if the value technically didn't change. This is going to be done better in the near future...

You should not use it in angular-ui. @matsko's form refactoring will likely make it useless and we will be able to revert it.

@caitp
Copy link
Contributor

caitp commented Aug 20, 2014

/cc @matsko please inform me if you've already made that "feature" redundant, because it would be really nice to get rid of it

@dimirc
Copy link
Contributor Author

dimirc commented Aug 20, 2014

@caitp how will you suggest to force this rerun then?

@caitp
Copy link
Contributor

caitp commented Aug 20, 2014

In the future, most of this stuff will be moved out of $parsers/$formatters, and you should be able to just use the validate() api which is already exposed. Currently validate() isn't enough for this because the code which we need to revalidate lives in parsers/formatters, but it won't soon (I hope!)

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

No branches or pull requests

2 participants