Martin Abrahams Team : Web Development

My first impressions of AngularJS

Martin Abrahams Team : Web Development

I've been sitting on the fence for far too long with the idea of adopting a JavaScript framework. A couple of years ago I had a half hearted attempt at using KnockoutJS and within a very short time found things about it that I didn't like about it (specifically around it's templating engine), however at the same time I was still very impressed by it or moreso of the concept of a framework in general. It was obvious to me at the time that frameworks were still in their infancy so I'd sit back for a while and watch it all unfold. Just as with JavaScript libraries ~8 years ago there was the battle between MooTools, Prototype and JQuery but it didn't take too long for a clear winner to emerge.

After reading plenty of blogs and talking to other devs it was sounding more and more like AngularJS is emerging as the framework of choice. Obviously it's a very subjective topic but I'd heard enough positive news about Angular to invest some time into it.

Not everything I've read is positive regarding AngularJS, as with every technology it's not without it's critics. The two primary concerns which I could find are that it's overly complicated and that it's going against HTML standards.

So armed with this information I jumped right into it and have now started developing small components in production websites. I'm not ready to built a fully blown single page application just yet, but I have to say so far that I haven't been as excited about anything in web development in a long time. For me, coming as a predominately back-end developer working within the MVC pattern Angular just makes perfect sense, this is the maturity that I've been looking for from JavaScript. Everything I've tried with Angular to date just fits and makes sense and it continues to surprise me every day.

So far these are the pros and cons which I've found. I've only been playing with Angular for a few weeks now so this is by no means a comprehensive list.

Pros

  • Pattern based development - As a .net developer this is music to my ears. Using the familiar MVC pattern allowed me to take to this like a duck to water.
  • Animation - I'm massively impressed by Angular's approach to this. Angular can automatically apply standardized CSS classes to objects when event's occur (such as hide or show) which allow you to style these in pure CSS and apply transitions without needing to bloat out your JavaScript with mountains of bespoke code.
  • Built in templating engine
  • Support for testing

Cons

  • DOM manipulation - This is where it can get unnecessarily complex in my opinion. Angular takes care of most common DOM manipulation behind the scenes so I've found that there's far less need to actually manipulate the DOM, but when you do, it can become hilariously complex. This is where the question is raised if you need to do a hybrid of JQuery and AngularJS or stick it out and do it within Angular.