Mastering Web Application Development with AngularJS - Book Review

This post is 4 years old. (Or older!) Code samples may not work, screenshots may be missing and links could be broken. Although some of the content may be relevant please take it with a pinch of salt.

I have been asked to review the book 'Mastering Web Application Development with AngularJS' written by Pawel Kozlowski and Peter Bacon Darwin (published by Packt). The book promises to help people learn AngularJS and understand how to create single-page web applications. The book is extremely beneficial for those who have a working knowledge of HTML, CSS and JavaScript - you can get up and running almost immediately.

One of the greatest things about this book is the fact that it has been reviewed by the AngularJS team, people such as Brad Green, Misko Hevery (aka the Father of AngularJS) and Vojta Jina - all this means that the book is very informative and you can be sure that it contains all the right information.

There are 12 chapters that make up this book broken down into logical sections, while the reader will be exploring how to build an example single page application. The chapters cover the following:

  • Chapter 1 gives a basic introduction to AngularJS. What is AngularJS, what's the philosophy behind it
  • Chapter 2 talks about how to build and test AngularJS apps and it also gives an introduction to a sample project, which is a SCRUM management application. To me, the choice to pick a project like this is a bit odd - I don't have much experience working in an SCRUM framework therefore it took me some time until to get my head around it
  • Chapter 3 discusses how AngularJS can be hooked up with a backend service, great if you are using something like MongoDB as your backend server, there's a lot of explanation on the $http directive as well as the AngularJS promises
  • Chapter 4 illustrates how to render the data that is received from the backend, basic directives and filters are also mentioned
  • Chapter 5 discusses how to manipulate data, using forms and other input methods as well as how to do data validation.
  • Chapter 6 goes into the details of navigation. A really great overview on how navigation works in a single-page web application.
  • Chapter 7 talks about user management - authentication and authorisation. Again, really great chapter because it gives a good overview on the security topic for a single-page web applications
  • Chapter 8 discusses how one can build a custom directive
  • Chapter 9 expands on chapter 8 and talks about custom directives with real-life examples
  • Chapter 10 illustrates how can AngularJS be used to create international applications - great for someone who is building an web application that requires internationalisation.
  • Chapter 11 goes deep down into the core of AngularJS and talks about its performance characteristics
  • Chapter 12 - the last chapter of the book - gives a good guidance on how to prepare a finished application for production deployment

As I had experience working with AngularJS before, some chapters - especially the first 2 - were not really beneficial, however I managed to read about a thing or two that I did not know about. If someone's an absolute beginner, I can see them benefitting from the initial chapters.

For a long time now I have been researching two things about AngularJS, form validation and authentication/authorisation and this book came in very handy as Chapter 5 and 7 cover these items.

Throughout my experience in creating websites and web applications, the most painful but (other than getting some of the regular expressions right) was form validation. AngularJS takes away this pain by some brilliant directives that can be utilised to validate forms on the front-end. Because AngularJS decouples the model from the view, it's very straight forward to add built-in validation. For example, if there's an input field that accepts an email address then, AngularJS automatically checks if the entered string is a valid email address, which in turn means that the model will never contain an invalid e-mail address. These other text-based directives allow the specification of minimum and maximum lengths as well as ngPatterns that accept regular expressions. This is great to control how complicated a password should be and whether it should contain upper case letters as well as special characters.

The book has a very detailed and methodological overview of forms in AngularJS, including but not limited to bindings, datasources, validation through ng-pristine, ng-dirty, ng-valid and ng-invalid. I love the explanation on how to show validation errors and how to add various css elements to individual input boxes/fields.

Another great chapter in the book is about authentication/authorisation. It's very important to know that the authentication and authorisation should happen at the server side - the book also points this out. It also discusses the various type of attacks possible in detail - such as cross-site request forgery (XSRF) and man-in-the-middle type of attacks and provides great explanation on how to overcome these using various techniques. Finally, the book also illustrates how to utilise the security service component of AngularJS, detailing how to create a 'security-aware' menu and toolbar - essentially showing/hiding information based on whether there's a valid user object (i.e. if someone is signed in or not.)

My final judgement is that if you're an absolute beginner, this book is a great read, as it gives a very good overview of the various pieces that make up AngularJS. For people who have some experience working with AngularJS, some of the more advanced topics can be useful. It probably could have been better if the example is something more generic, like an online cook-book or a car-dealership. (I know these are all cliche but they don't require further understanding, which is the case with the SCRUM example throughout the book.)