In the ui-angular-watch implementation we should not re-validate against the $modelValue but the $viewValue of the field since :
The problem can be reproduced on the demo page by filling the passwordConfirmation first, and then the password. The passwordConfirmation stays invalid which is not expected.
The attached pull request fixes the problem by triggering again the natural angular validation process by simulating a change in the $viewValue
For instance, with this fix, the following cyclic five fields dependency schema works like a charm
A -> B -> C -> D -> E -> A
Fix broken ui-validate-watch retroactive dependencies
Fake tag version
Since you are triggering the entire stack of validators there is no reason to have multiple watches, and since you have multiple watches there is no longer a reason to wrap the expression in a string and double evaluate it.
You should also update the tests and possibly add one for your patch
Simplify ui-validate-watch syntax
See issue #472 for details.
String removed. Much simpler. Not backward compatible.
Please ignore the commit 8c084ea: Fake version tag. Nothing to do with this issue.
8c084ea: Fake version tag
Any news about this issue ?
I ran into this same issue today. Is there a temporary workaround while we wait for the pull request?
The pull request IS the workaround.
This works great, thanks! One thing worth mentioning is that the model in the ui-validate-watch attribute must not be quoted as currently shown in the docs.
And one problem -- this method sets the field to dirty right off the bat, which can be problematic for styling.
This isn't working for me in 1.2. I'm trying to verify that a specific field is less than another, and vice versa.
<input type="text" autocomplete="off" id="startDate" maxlength="4" name="startDate"
ui-validate="$value <= education.endDate"
ui-validate-watch="education.endDate" required />
<input type="text" autocomplete="off" id="endDate" maxlength="4" name="endDate"
ui-validate="$value >= education.startDate"
ui-validate-watch="education.startDate" required />
Am I doing something wrong here?