Building Momentum with AngularJS
I recently completed a design and coding project using MongoDB, Express, Angular, and NodeJS - otherwise known as the MEAN stack - and I have to say that it went a lot smoother than I expected. In honor of this accomplishment, I thought I would jot down some of my thoughts surrounding my experience.
I should start out by mentioning that I am not totally new to web development. In the past I have worked with HTML (back when alignment by tables was the rage) and more recently I have worked with backend technologies such as MySQL, PHP, and even some NodeJS. So as I was starting this project, the only piece that I was really exploring for the first time was that which makes MEN become MEAN - Angular.
As the title of this post suggests, I used AngularJS rather than Angular for this project. For those who are unaware, AngularJS is the 1.X.X version of the technology where as Angular (without the JS) is generally used to refer to the 2.X+ versions. There was a major rewrite of AngularJS between 1.X and 2.X which makes the versions incompatible so although they are more or less the same technology it can be argued that they are unique entities. I used AngularJS mainly because it is still quite prevalent out in the real world. If the times comes for me to learn the other flavor, I'm sure there will be a lot more information on transitioning form AngularJS to Angular than there would be to go the other direction.
So what were my thoughts about AngularJS? First off, I was a bit surprised at how many AngularJS specific tags needed to be injected into the HTML. I suppose when compared to the way PHP or other server based page generators work it shouldn't have been that surprising but it's a rather stark contrast to someone who has been living in a CSS world of traversing the DOM and manipulating elements directly without ever having to touch the HTML. Fortunately the tags were generally intuitive enough for me to get into the swing of it without too much trouble.
After overcoming the initial syntax shock, I quickly found myself enjoying the power and flexibility of AngularJS. Not only did it contain all of the normal flow control type abilities (conditionals, loops, etc) but it also had many build in conveniences like filtering, sorting, and display formatting. I'm sure I only used a very small portion of the available functionality but that's because the things I wanted to do were readily available and I didn't have to go searching for them. One of the only pieces that tripped me up for a bit was getting the data model that backed the page to refresh after an asynchronous action but once I found the $scope object, that was easily solved with a call to $scope.apply().
All in all I enjoyed using AngularJS. With a relatively low learning curve (for what I was attempting to do with it) I was able to make a much smoother, more responsive web page than I was ever able to do with PHP or other server based page generators. I'm sure I'll be using AngularJS again (and maybe I'll even look into Angular a bit to see what's been improved upon).