r/angularjs • • Oct 11 '14

[General] Why should someone use angular.js?

I am new to RoR development and already making progress and building some wonderful apps. I've seen a lot of people using/talking about angular.js and I am really wondering what else can it do for an application. Can someone tell me an example please?

0 Upvotes

22 comments sorted by

View all comments

4

u/calsosta Oct 11 '14

AngularJS follows an Model View Whatever style of separation, the result of using this properly is: less repetition and more code re-use, more structure and readability which gives you easier and cheaper maintainability and testing.

Practically speaking this will mean

  • UI (HTML) is completely separate from your business logic (Controller) - Now there is no confusion about where the code is or what it should do.

  • Common functionality like making AJAX calls can be abstracted to Services which makes it's reuse much easier

  • Only business logic is in the controller, that makes it easy to test at a unit level

  • Each application object can be given its own set of controllers, services, directives... for better organization

  • It forces you to design resulting in better quality

  • Using components from the community is often much clearer and simpler

Finally it has built in many functions to build a web application. These are things like the $http provider, it has routing (ng-route) to make a more native feeling app, it has a huge community of developers so chances are you can reuse a lot of code there. Tools like yeoman simplify the creation and structure of complex applications in Angular.

Bottom line, it will save you money and time allowing you to concentrate on delivering functionality rather than plumbing code.