Home Java 7 reasons why AngularJSis cool

7 reasons why AngularJSis cool

by admin

A rather liberal translation of the note 7 reasons why angularJS rocks
7 reasons why AngularJSis cool
I’m a backend developer and the world of Javascript frameworks is fairly new to me, although my interest in them has been growing strongly in the last six months.The reason is simple: I believe that the REST + JSON + Rich JS stack of technologies is increasingly suitable for a wide range of web applications.This approach helps defeat crappy questionable concept of MVC in server-side applications.Why MVC can be considered harmful is a separate story, now it’s better to talk about AngularJS
What’s so special about AngularJS?

Dependency injection as standard

Which gives you cleaner interfaces, transparent dependencies, and keeps your architecture in good shape.

Modular testing capabilities as standard

And this is not just throwing words to the wind, as. Miško Hevery is a key developer who is known (at least to me) for his advocacy of testing.

e2e tests make it easy to wet queries

Your tests do not depend on server-side services. You can completely isolate your tests :

$httpBackend.whenGET("http://api.example.com/data").respond({'data': 123});


You make the most of HTML attributes, thus saving hundreds of lines of javascript code.

Great open source community

Almost instantaneous (usually a couple of hours) responses at mailing list Quick solutions to pull requests. Key developers are open to discussion.

REST friendliness

AngularJS is really REST friendly. This is how you can get a list of repository commits on Github:

var commits = $resource('https://api.github.com/repos/:user/:project/commits').get({user: 'mkotsur', project: 'gitoscop'})

Scopes, bindings and watches

You have scopes whose changes are tracked and whose models can be linked to HTML elements. All updates work automagically with $scope.$watch.
In order to get more familiar with Angular, I created a "toy" application that uses the Github API to present an interface to work with the latest commits and diffs of a selected repository. Demo : http://mkotsur.github.com/gitoscop , code : https://github.com/mkotsur/gitoscop
End of translation.
A little addition for the jungists :

  • template tag conflict — stackoverflow.com/questions/8302928/angularjs-with-django-conflicting-template-tags The upper answer is for 0.9.x, the second answer is for 1.0.x.
  • For csrf I am currently using something like this :
    var module = angular.module('Cabinet', [], function ($interpolateProvider) {$interpolateProvider.startSymbol('[[');$interpolateProvider.endSymbol(']]');}).config(function($httpProvider){$httpProvider.defaults.headers.common['X-CSRFToken'] = '{{ csrf_token }}';});

Some interesting links :

You may also like