AngularJS may be the latest JavaScript framework darling of the web world, but like all technologies it comes with its share of frustrations.

AngularJS has exploded onto the web world with no small help from Google such that its hard to imagine doing a web based application without giving it at least a passing consideration.  My first impressions of AngularJS was that it made JavaScript client side development nearly appealing, particularly if you start with TypeScript.  But after spending some time and researching the issues that others have had, I can see that it’s not quite the “One Framework to Rule Them All” I was hoping for.  Here are the top 5 frustrations I have seen so far.

  • Client Side Rendering – Being the shiny new hammer in our web toolkit it’s tempting to want to whip out AngularJS and pound out a client based SPA for any web site.  But client based rendering isn’t the best design model for websites that primarily present static content.  This is particularly true if you want your content to be discoverable as most search engines have trouble indexing content displayed as a result of client side processing.  AngularJS is a good tool for highly interactive applications, particularly when presenting significant amounts of data for viewing or editing.  But if you all you want to do is advertise your company or your blog, you’re probably better off with server based UI rendering.
  • $scope Woes – There is quite a bit of FUD being thrown around with regards to how AngularJS does scoping of databound elements.  While many of these complaints are little more than “Which ‘object.foo’ am I really binding” (Hint:  Stop using Foo for your Model attributes), there is a very real concern with how AngularJS binds $scope.  The issue centers around how DirtyChecking triggers a recursive check of all scope properties.  The end result is that if you bind too much data your app can start to suffer a slow and painful death.  This can of course be managed with optimizations of your model, but ultimately a bit less complex of a binding mechanism might make more sense.
  • Complexity – Another common complaint about AngularJS is how difficult it is to learn.  Picking up AngularJS as a solution for quick databinding is a bit like driving a penny nail with a sledge hammer.  Ultimately AngularJS isn’t simply a “helper” library.  When you buy into it, you really do need to buy all the way into the programming model which means learning about services, directives, factories, injection, and all of the other uber-geek abstractions that AngularJS imposes.  Fortunately we have several WintellectNOW courses to help you move up that learning curve as quickly as possible.
  • Dependency Injection is not Minification Friendly – Most enterprise or mobile web developers know that bundling and minification of JavaScript libraries is an important performance enhancement that we all want to use.  Of course we’re going to want to minify our own AngularJS code as well but that can break your dependency injection.  The code below will break with minification.

[code language=”js”]
function MyController($scope, $window) {
// …
}[/code]

You can work around the issue by passing in the injection targets as an array of string literals, but this smells like a hack and is error prone since most IDEs don’t check string literal contents.

[code language=”js”]
module.controller(‘MyController’, [‘$scope’, ‘$window’, MyController]);[/code]

  • It’s all changing in AngularJS 2.0 – While still in development, AngularJS is by all intents a complete redesign of the AngularJS framework.  Many of the abstractions that current AngularJS uses like controllers, directives, $scope, and modules are gone making migrating existing apps a daunting endeavor.  How daunting is the question but at this point nobody really knows.  And while the AngularJS team has a lot of very good reasons behind the design changes, this is going to be a tough pill to swallow for early adopters.

At this point you might be thinking that I’m anti-AngularJS.  That’s not the case at all.  But like every technology that came before it and all that will come after, you still have to use your best judgement on how/when to apply it.  New JavaScript frameworks are literally coming up every day (some have probably been released and killed in the time it took to write this post) and so if AngularJS doesn’t meet your needs, as they say in the London Underground “Another train will be along shortly”.