By Bill Lenoir
Development teams are always on the lookout for more powerful tools that allow them to build better web applications faster. And it feels like there has been an unending stream of them over the last decade. AngularJS, an open source framework out of Google, is the latest. I admit that I was hesitant to jump on the bandwagon, but my experience tells me this is worth it, as long as you take into account some potential pitfalls.
AngularJS is Different
JQuery was a giant leap forward. It simplified element manipulation, event handling and AJAX application development. What used to be a complicated, twister-like logic just to select a specific element on the page was reduced to a single line of code. This is great at the tactical level, but you still could not easily develop a dynamic view based on the content.
- Templates: These are a view into your application. As the data changes, the view changes. You no longer need to worry about that in your code.
- Dependency Injection: Your web application no longer needs to be written as one mass of code. You can easily segregate presentation, data and control as needed to allow for a more easily maintainable and readable code-base.
- Test Framework: More on this below, but understand that AngularJS was developed from the beginning to be easily testable.
- Package Management: AngularJS is integrated with Bower, Node and other package management systems that automate the process of installing, upgrading, configuring and other aspects of ensuring AngularJS is up to date.
AngularJS is Easier to Test
AngularJS by itself is NOT SEO friendly
What a user sees on a web page generated by AngularJS (or any other AJAX framework) differs greatly from what a crawler from Google or other search engines see. This means that unless you take steps to rectify this, your content will not be findable on these search engines.
A key decision point on whether or not to use AngularJS is how important SEO is to your content. If the whole site needs to be crawable, you should probably forgo AngularJS. If you don’t care at all, fine. If you’re somewhere in between, you will need to factor into your level of effort the time and resources needed to develop an HTML snapshot the crawlers can read.
AngularJS is NOT a UI Framework
Conclusion: AngularJS is Great for Web Apps, not Pure Content Plays
If you are developing a web application that does not need to be crawled by search engines, then AngularJS makes sense since it streamlines your development and, perhaps more importantly, your testing. For more traditional web feature sets, AngularJS is probably over-kill. Don’t be sad, though, JQuery is still a very powerful tool.