Posted by fusionbox on March 21, 2013, 6 p.m.
I recently started experimenting with AngularJS for a new project. I have never entirely wrapped my brain around backbone Views and despite many well documented examples and tutorials, I never quite know where to start. The lack of 'batteries included' has been a barrier, and I find myself paralyzed with options, unsure which direction to go.
Enter AngularJS. Angular is as big in all the ways that Backbone is not, and where backbone leaves you room to choose your desired implementation, Angular does not. The jury is still out on exactly how I feel about this.
I've only just begun exploring Angular and am yet to get very deep under the hood. Here are a few things of my experiences thus far.
HTML is your template language. Angular introduces its own attributes which are referred to as directives. In the documentation, Angular say "directives are ways to teach HTML new tricks". My impression thus far is that this is really cool, and it may be a bad idea.
In jQuery or Backbone, you would use a selector to get the html element you wish to bind to, and then bind a callback to a `click` event. With Angular, you still have the same callback, but the binding syntax lives within your HTML.
<a click="doit()">Do Thing</a>
The double-curly template syntax will be familiar to many django developers. In this example, Angular will automatically bind the `foo` property of my controller to both the value of the input via the `ng-model` directive, and the text within the `p` tag. These two values remain in sync with each other without further action on my part.
I've only started to scratch the surface of how powerful this can really be, though I admit I haven't done enough to find many of the downsides.
Speaking of downsides, I am disappointed in the tools Angular provides for ajax and server communication. They don't seem to be very configurable (not a big surprise), and they set some significant constraints on the format of your data.