5 ms·
Well, bi-directional data-bind is really easy. There is really minimum code needs to be written. But when you need to create a reusable directive (widget in Ang
by kailuowang 14y ago
Well, bi-directional data-bind is really easy. There is really minimum code needs to be written. But when you need to create a reusable directive (widget in Angular), it's hard to even find out where to start. You might need to write many lines of boilerplate configuration code that takes quite a while to learn and understand. In contrast, when you need to create a reusable widget in Backbone, you can just write a view class like any other view class. To be fair, it is in Angular team's plan to simplify directive development, so that it will be like writing just another controller.
- aidos 14y agoThere's definitely a little more work involved in directives. I don't think there's much boilerplate in writing them though. There's certainly more work in understanding how they work initially, but that's a small price to pay for the reusability they give you.
- mc 14y agoI agree. At first glance there's a lot of shorthand (@, =, ^, ?, &) but that knowledge comes with time. I experienced a lot of confusion with the compile() and link() functions that I feel could have been prevented with better docs. Until that's done, I recommend the path I took: lots of experimenting and watching John Lindquist's videos over on egghead.io.
- rmason 14y agoI'm just learning myself but looking at others code helps, you might find the UI library helpful as there are lots of directives and filters https://github.com/angular-ui/angular-ui#readme https://github.com/angular-ui/angular-ui#readme Also Google 'ben nadel angularjs directives' and he provides numerous examples. Good luck!