AngularJS Pros and Cons
Not sure about AngularJS? Oh boy – read this first (grand daddy list of all single page application development frameworks)
Pros (first of course!) of AngularJS
- Two way Data binding
The templates in AngularJS work differently. The template (written in HTML) is compiled on the browser. After compilation any changes to the view are immediately reflected in the model and vice versa. This programming model simplifies the task for the developer.
- Easy Testability
In AngularJS, the view is only a projection of the model. The controller is separated from the view. This allows the programmer to test the controller in isolation without the view. It helps the programmer to test DOM/browser dependency.
- Quick Prototyping
While building a prototype you will be using data binding features most of the time. All you need is a bootstrap (it has many libraries), Angular Bootstrap UI (it wraps useful bootstrap components with AngularJS directives) and some libraries that you find useful. Once you have these things ready, you need to set up your controller for Angular code in the body of the page and then start building your UI using boot strap components. Then, build some dynamic UI stuff, use an Angular directive and your prototype is ready for testing.
BTW, interested in a quick way of getting started? Read this post about a modular approach to creating AngularJS projects (seed)
- Dependency injection system
AngularJS implements Dependency injection system where the components are not hard coded but are given their dependencies. This allows the programmer to make components reusable, testable and maintainable.
- Fast loading
Once the initial page is loaded other pages are loaded very fast.
Interested in learning more about AngularJS performance improvements? We have you covered here.
Cons (not too fast buddy) of AngularJS
- Forces unwanted downloads
A site using AngularJS may have many page views. When the user tries to load the site many views are automatically loaded whereas the user is only interested in only one view. This leads to download of unnecessary code, information and content.
- Hard to debug
AngularJS is hard to debug unless you know how every component fits in and how it works. There is no easy way to debug the errors unless you completely understand it. Besides if the user is undefined, errors in bindings will not be fired. You cannot find errors using the debugger. If any error is fired in the digest cycle, the reason can be change in any variable in whole application.
- Learning curve very steep
- Directives are difficult to use
The directives are the most interesting part and also the most difficult. While using the directives you need to first understand why you need it. This means before writing the code you have to think a lot on how to do it. You need to integrate code and wrap in the directive before using it. The naming convention in Angular also adds to the confusion. For example, the controller function in the directive has same name as usual controller.
With AngularJS 2, you can expect majority of complexity disappearing and AngularJS becoming more popular in developers. Here are a few more resources in case you are interested in playing around more with AngularJS
How to upload files directly to AWS S3 from your AngularJS code.