Pros and Cons of AngularJS

by John H
7 minutes

Javascript frameworks seem to be the new hotness these days - AngularJS, Ember, React, JQuery - the list goes on and on. Why so many? That is a question for another day, but Angular is one of the most popular. Is Angular worth all the hype? Possibly! Hopefully after reading this you can decide if Angular or some other Javascript Framework would be beneficial to your project.

PROS

There are many reasons to be excited and interested in this Javascript Framework.

  • Shifts Computing Power from Server to Client
  • Allows for Pretty transitions
  • It's typically snappy and fast loading
  • Makes websites appear more ap like - which is great for mobile interaction
  • Allows developers to adhere to MVC development framework and workflow

Of course there are some reasons not to employ Angular or someother JS framework too.  Here they are in a list

  • Forces unwanted downloads
  • Possible display errors or total display failure
  • Possibly not supported
  • Limits pageviews which could effect Ad revenue
  • Forces developers into a MVC framework

Below, I'll talk about each one in more depth.

Shifts Computing Power from Server to Client

One of the biggest reasons to use Javascript is for its usefulness to communicate with a server on the client side.  Onclick events and triggers are all handled in Javascript - and until CSS3, animations were handled by Javascript (or Flash).  This is great since many of those processes are CPU intensive; basically "Make the client's computer handle the heavy lifting".  In the same line, AngularJS has many features that are very focused on animating elements in the HTML DOM.  Angular is also focused on manipulating content on the page.  You can pull in JSON objects, display them as lists or divs and then use Angular to rearrange and filter them based on their object values.  All of this is handled in the clients browser, far away from the server's CPU.  This means that the hosting server can focus on important things, like serving pages to more users.

Allows for Pretty transitions

People love animations and movement and Angular allows for easy integration with CSS3 animations.  Since Angular is built as a templating MVC Framework, you can animate views as they are requested by the user.  By adding transitions to pages it makes the applications come alive.  Things look more impressive, looking more like the web of Hollywood, than the static, drab pages of 1995.  With Angular and CSS3, animate lists, divs, views - pretty much anything and bring a exciting new dimension to web sites.

It's typically snappy and fast loading

One of the most appealing things about Angular is that it can allow a user to load what seems like many pages into one page.  Once that initial page has been downloaded views are updated and manipulated instantaneously with Angular - there isn't any delay at all - the ap and site look snappy and responsive and generally make the end user happy with the experience.  Tie in some AJAX and the site can update without having to reload any assets.  Angular makes putting everything on one page a cinch.  While this is a pro, it is also a con (which I'll discuss in the Con section).

Makes websites appear more ap like - which is great for mobile interaction

People are accessing sites more and more with mobile devices - like phones and tablets.  Using Angular makes your site appear more like an ap - screen to screen transitions are very app like.  It also makes your site information architecture more self contained and less like website that updates from page to page.  Angular adheres to a strict MVC framework that is very familiar to developers used to app development. Additionally the presentation of the site in Angular using partials and templates mean the site is automatically more modular and app like than the typical IA a website might have.

Allows developers to adhere to MVC development framework and workflow

When you look at an Angular project your see folders for Models, Views and Contollers (not necessarily in that order, or named that way - but definitely grouped that way).  Developers that come from a more traditional background of developing and compiling will love this type of development workflow.  It is a great way to break up the website into parts that are self contained and easy to update, manage and scale. Many developers hate working on web projects because of the unruly nature of procedural, unorganized web projects.  A framework automatically creates convention that is recognizable to any seasoned developer.

CONS

Forces unwanted downloads

Using Angular could force a user into downloading unwanted information, content and code.  Depending on the way a site is developed in Angular, a user is going to download content that they aren't looking for. For example a site may have many views loaded into the page, but the user is only interested in one view - that means all the additional views content was just loaded for no reason.  Of course this can be avoided using Angular JS routing or with proper AJAX calls, but out of the box there is going to be some kind of waste, in the form of unused filtered results, or unused views.

Possible display errors or total display failure

Let's be honest, Javascript can break and take a site down with it.  In the web world, pages can display regardless of their W3C compliance.  HTML doesn't care if that list item tag is complete or not.  But as soon as you throw Javascript into the mix you are asking for trouble.  Atleast with a serverside scripting language you just have to worry about the server.  With Javascript you have to worry about every computer accessing the server.  You have to worry what kind browser is accessing the site, whether javascript is even enabled, and whether it is even capable of handling the Angular Frame work. If a computer is having trouble processing the Angular file then it will take the site along with it.

Possibly not supported

If a computer is old, it may not work. Granted you might not care about a user using a Pentium 2 running Mosaic, but it is still something to consider.

Limits pageviews which could effect Ad revenue

This may not be the case, but depending on the usage of Angular could effect your ad revenue on a site.  Typically pageviews are figured into CPC ad models.  Also some ad systems will only allow so many ad instances on a page.  I'm not totally sure about now, but  Google Adsense used to only allowed 3 ad units per page. If that is still the case then loading all of your content into one page would really cut into potential page views.  Granted this might be avoidable with use of AJAX or some other type of integration, but it is definitely something to consider if your site revenue model is based around ad views.

Forces developers into a MVC framework

This shouldn't be a deal breaker, especially since MVC is such a commonly used development model, but if your dev team isn't used to developing their sites, split into templates and pieces then it could slow down your development time cycle.  If you are considering Angular then I'm sure this isn't a concession.

All in all Angular is pretty cool and could offer a little spice to your website projects.  It is definitely buzz worthy - and might be worth looking into if you are interested in Javascript frameworks.

Related Articles

Pros and Cons of Bootstrap

What is Bootstrap If you haven't heard about Bootstrap and you've been building websites...

John H John H
10 minutes

Less Pros and Cons

You might be wondering what Less is?  It is a Css preprocessor - just like Sass or Stylus.  So,...

John H John H
8 minutes

PHP and Class Variables

Pass a variable into a class through the construct($variable) function Variables set in the...

John H John H
~1 minute