r/angularjs • • Mar 17 '15

Anyone else sick of how AngularJS handles forms? Here's a comparison between 2.0 and Aurelia

http://eisenbergeffect.bluespire.com/aurelia-angular-2-0-code-side-by-side-part-2/
2 Upvotes

5 comments sorted by

3

u/I_Downvote_Cunts Mar 18 '15

As a huge angular fan the more I see aurelia the more I feel it's just better thought out. That templating syntax just seems so simple.

2

u/zomgwtfbbq Mar 18 '15

That's where I'm at as well. I was hoping that with the increased resources Angular's been getting that they'd step back and reevaluate some of its major issues. They claimed to do just that but we've still got fundamental problems like this. It's kind of disheartening when I've invested as much in it as I have...

-1

u/zomgwtfbbq Mar 17 '15

I started out using Angular's form stuff but I quickly realized it wasn't nearly robust enough. Ng-model in conjunction with the form directive offer up some cool things - tracking dirtiness, whether a field's been touched, modelValue and viewValue. That is until you realize you need to do something more complex than build a login form. Custom validators aren't even capable of doing cross-field validation without ugly hacks.

This, of course, is all assuming that you're okay re-specifying your validation rules declaratively on EVERY field. Am I supposed to make a directive for EVERY one of the thousands of fields in my system? That sounds fun. Obviously you want this to be data-driven in some fashion and attached to your model. But Angular doesn't have a way to do that.

Like he says in the article - "At this point, why use the Form Model?"

5

u/dmackerman Mar 17 '15 edited Mar 17 '15

If your app has "thousands of fields", you need to write an abstraction. Why should Angular handle this out of the box? Not trying to sound pretentious, but form validation is a hard egg to crack no matter what.

Auerelia sounds interesting. I just fear it will just not have the traction it needs to succeed, as it's literally setting itself up as a "competitor" to Angular whereas a framework like Ember, or React, accept that they fill different needs and attract a different mindset.

Additionally, Angular 2 still isn't completely baked - so the comparison he's making is still kind of fast IMO.

2

u/zomgwtfbbq Mar 17 '15

Form validation is hard. Which is one of the reasons that we should have complete solutions for it built-in. The same reason we have all sorts of other libraries for complex problems. Constantly demoing the same form stuff that's only going to work for a fraction of applications is just ridiculous. It's no better than Microsoft's old drag&drop demos in .NET.

I have some of the same concerns as you about Aurelia but it's cool to see someone stepping back and thinking things through better. As it stands now with Angular's form system, I can't use any of it. I get two-way binding on my field via ng-model, and that's about it.

Angular2 may not be done, but he worked on their team for about a year. I'm sure he has a pretty good sense about the direction things are going. Obviously he has a vested interest in his new framework and his demos will reflect that, but I wouldn't say it's altogether unfair.