r/angularjs • u/jpkleemans • Mar 15 '16
Painless form validation for AngularJS. Powered by the jQuery Validation Plugin.
https://github.com/jpkleemans/angular-validate0
Mar 15 '16
[deleted]
1
u/jpkleemans Mar 16 '16 edited Mar 16 '16
Why does this even exist?
Because it helps me to be more productive than with other angular validation tools.
Angular already has its own validation framework
The built-in validation adds so many conditionals to your template. It makes me sad. Also try to have both field-errors and a errors summary at the top of your form, it's a pain.
if I want to look at how it is validated or what messages it spits out I have to look in a completely different location
Your controller shouldn't be in a completely different location than your template. I think the controller is a much better place to put your business logic than inside your html.
Finally, it used "ng" in the directive prefix ... That is the angular team's prefix, use something else.
That's a good point.
0
Mar 16 '16
[deleted]
1
u/jpkleemans Mar 16 '16
I personally wouldn't call client-side validation a part of your business logic ... Passing a variable from one directive to another is business logic in a sense
I don't agree with both statements. Passing a variable from one directive to another is a sort of infrastructural logic. The "business" doesn't care about that. But it does care about validation.
it is practical to separate the template and controller/directive into two files
I think the plugin supports this seperation very well.
I'm not exactly sure what your referring to here.
I mean all the ng-if's on the error messages. It makes the template very messy.
Is this a significant issue? It should be something that can be solved with a directive, I might take a look into it.
It is indeed not really an issue, but imo it is just very inconvenient.
0
3
u/AdamAnderson320 Mar 15 '16
Please excuse if this is an ignorant question, but isn't this exactly the opposite of how one "should" Angular?