-
Notifications
You must be signed in to change notification settings - Fork 58
Field level validate on empty not working #160
Comments
Hello, if you think that you can change the code to fix the issue, I certainly welcome PR (pull request) |
I will try.. let you know asap. Thanks for prompt reply as usual 👍 |
Looking at this opened ticket and reviewing what you wrote. You might have misunderstood what this does. This is meant for doing a validation even if the field is empty and doesn't have a "required" validation. You haven't provided any code (I prefer a Plunker to work with), so it's hard to help you out. |
Sorry for late reply was busy. All I was trying to tell was if we try to use field level attributes to validate to check if field is empty or not (as a service not directive) then line number 101 fails. From my analysis it should be Instead of current Current logic takes Global property not the field level property. Thanks. I'm sorry I don't have plunkr available. I will try to make one. |
Have you tested it in your environment? You can use the unbundled version of Angular-Validation and modify the |
Okay. So I finally created a plukr here |
I pushed a fix with some of your recommendations, please use the new version 1.5.24, thanks |
Awesome. Thanks a lot. :) |
as per
https://github.com/ghiscoding/angular-validation/wiki/Inputs-(local-options)#validate-on-empty
we should be able to set validate on empty via code for a particular field. Unfortunately this option is not working. I'm afraid the issue is happening in the ValidationService inside addValidator function. From my analysis I feel problem is at
https://github.com/ghiscoding/angular-validation/blob/master/src/validation-service.js#L101 . we should be accessing attributes from attrs instead of self.validationAttrs . If attrs are not available then we should try to access self.validationsAttrs . (if element level validations not specified try getting value from global level validationsAttrs )
Can you please look into the same?
The text was updated successfully, but these errors were encountered: