Skip to main content

Mastering Web Application Development with AngularJS - Book Review

4 min read

Older Article

This article was published 13 years ago. Some information may be outdated or no longer applicable.

I was asked to review ‘Mastering Web Application Development with AngularJS’ by Pawel Kozlowski and Peter Bacon Darwin (published by Packt). The book sets out to teach AngularJS and how to build single-page web applications. It’s well-suited for anyone with working knowledge of HTML, CSS and JavaScript. You can get moving almost immediately.

One of the best things about this book: the AngularJS team reviewed it. People like Brad Green, Misko Hevery (the father of AngularJS) and Vojta Jina. That means the information is solid.

Twelve chapters make up the book, broken into logical sections. The reader builds a sample single-page application as they go. Here’s the breakdown:

  • Chapter 1 gives a basic introduction to AngularJS: what it is, what drives it
  • Chapter 2 covers building and testing AngularJS apps, plus introduces the sample project (a SCRUM management application). Odd choice of project, in my opinion. I don’t have much experience with SCRUM frameworks, so it took me a while to wrap my head around it
  • Chapter 3 discusses hooking AngularJS up with a backend service. Great if you’re using something like MongoDB. There’s solid explanation of the $http directive and AngularJS promises
  • Chapter 4 shows how to render data received from the backend, covering basic directives and filters
  • Chapter 5 tackles data manipulation through forms and input methods, plus data validation
  • Chapter 6 gets into navigation. A genuinely useful overview of how navigation works in a single-page web application
  • Chapter 7 covers user management: authentication and authorisation. Another strong chapter with a good treatment of security for single-page apps
  • Chapter 8 discusses building custom directives
  • Chapter 9 expands on chapter 8 with real-world directive examples
  • Chapter 10 shows how to use AngularJS for international applications. Handy if you’re building something that needs internationalisation
  • Chapter 11 goes deep into AngularJS internals and performance characteristics
  • Chapter 12 (the final chapter) gives guidance on preparing a finished application for production deployment

I’d worked with AngularJS before, so the first couple of chapters didn’t tell me much. But I still picked up a thing or two I hadn’t known. For absolute beginners, those early chapters would be valuable.

Two topics I’d been researching for a while: form validation and authentication/authorisation. Chapters 5 and 7 cover both, and they landed at the right time.

Throughout my experience building websites and web applications, form validation has been one of the most painful tasks (aside from getting regular expressions right). AngularJS strips away that pain with directives that validate forms on the front end. Because AngularJS decouples the model from the view, adding built-in validation is clean. An input field expecting an email address? AngularJS automatically checks if the string is a valid email, which means the model never contains an invalid address. Other text-based directives let you specify minimum and maximum lengths, plus ngPatterns that accept regular expressions. Useful for controlling password complexity (upper case, special characters, that sort of thing).

The book gives a detailed, methodical overview of forms in AngularJS: bindings, datasources, validation through ng-pristine, ng-dirty, ng-valid and ng-invalid. The explanation of showing validation errors and applying CSS to individual input fields is well done.

The authentication/authorisation chapter is another highlight. The book correctly points out that authentication and authorisation should happen server-side. It covers various attack types in detail (cross-site request forgery, man-in-the-middle attacks) and explains how to defend against them. It also walks through the AngularJS security service component, showing how to create ‘security-aware’ menus and toolbars. Essentially: showing or hiding information based on whether there’s a valid user object (whether someone’s signed in or not).

My verdict: if you’re an absolute beginner, it’s a solid read with a thorough overview of AngularJS’s moving parts. For those with some experience, the advanced chapters pull their weight. The sample project could have been more accessible (an online cookbook or car dealership, maybe). Those are cliche, sure, but they don’t require extra domain knowledge the way the SCRUM example does.