-
Notifications
You must be signed in to change notification settings - Fork 58
Bug in validation service addValidator function #153
Comments
have you tried it? Ah actually, I see what you mean now. Will update soon after running all tests during lunch. Thanks |
Hi thanks for replying on the issue instantly. I was actually using library for some validation scenario where I don't need required validation but instead I need to call a custom validation. After digging into documentation I found out about validateOnEmpty flag. When I tried to use it in my implementation it failed. As we don't have a non minified version in dist folder I manually copied all JS files and created non minified version. Earlier I thought it had something to do with my wrong implementation but later I realize code is failing at the line which I mentioned above. Two three lines below you have accessed commonObj from self. Replacing the line with the self.commonObj worked fine. I am not very sure about the impact it is going to cause. But I thought would let you know. Your work is awesome! Just one request if possible please have a minified and non minified version in dist folder. It would be great. |
The minified is just a bundle of what is in <script type="text/javascript" src="src/validation-directive.js"></script>
<script type="text/javascript" src="src/validation-service.js"></script>
<script type="text/javascript" src="src/validation-common.js"></script>
<script type="text/javascript" src="src/validation-rules.js"></script> |
Actually that's a good idea and easy to modify the Gulp, I added it. A new version 1.5.20 just got pushed (you're lucky I'll be away for the next 3 weeks). |
Thanks @ghiscoding . It was way faster than I would have imagined. And also thanks for adding non-minified version too. |
It was easier since you provided the code to change, cheers for that ;) Also, if you like it and haven't clicked on the ⭐ yet, then please do so as it's also nice to see the counter going up :) Thanks for providing the code. |
Hi There is an issue with addValidator function which resides under ValidationService. In Case of validateOnEmpty : true option set in global option code fails at
_validateOnEmpty = (self.validationAttrs.hasOwnProperty('validateOnEmpty')) ? commonObj.parseBool(self.validationAttrs.validateOnEmpty) : !!_globalOptions.validateOnEmpty;
Instead of above line it should have been
_validateOnEmpty = (self.validationAttrs.hasOwnProperty('validateOnEmpty')) ? self.commonObj.parseBool(self.validationAttrs.validateOnEmpty) : !!_globalOptions.validateOnEmpty;
The commonObj resides inside self in that function hence if we directly access it, it ends up failing the code.
[edit : fixed bad language]
The text was updated successfully, but these errors were encountered: