-
Notifications
You must be signed in to change notification settings - Fork 58
Incorrect validation on "required" with a value of 0 #177
Comments
Hmm that could be a bug, but yeah I probably won't spend much time on troubleshooting it because as you said it is in "Life support mode" but I certainly accept PR if you find the bug for sure. If I look at the code, most of every validation rule are driven by RegEx (which BTW is awesome) and you can see the Quickly looking at the code and searching for the word "required", I can see that I do check for the value to be not empty string, neither undefined or null here but on this other line I checked the value as EDIT |
I believe I've fixed the issue. The cause is line 406 in validation-directive.js. In the
...but this causes I've updated this line to be:
and the issue seems to be resolved. Now, as I've mentioned, I've never done a pull request. I'm currently reading about how to do that, so it might be a little while... hahha. |
@mgm09a I quickly looked at the PR, it seems fine, I'll review it more in depth tonight and will probably push a new release by then. Thanks again 👍 |
I understand this project is just on life support, and I know that you've mostly moved on to working with other technologies, but I wanted to ask if this odd behavior was by design before I attempted to investigate much further.
http://plnkr.co/edit/t2zzENCdQp163F4IsZH3?p=preview
In this Plunker, you'll find an example of some odd behavior. On my
ng-model
, the value is initialized to0
. Theselect
element to which it is bound is decorated withvalidation="required"
, but the classes that initially get assigned to that element indicate that it is invalid.I would have expected that a value of
0
would have satisfied thevalidation="required"
rule, but perhaps that was a mistaken assumption.More interestingly, if I change the selection to another value, then back to
0
, therequired
validation passes. This makes me think that something is not right, as the behavior changes after the element becomes dirty.Should this behavior remain the same, or should I look into creating a pull request (my first ever) to try and fix it?
The text was updated successfully, but these errors were encountered: