Book review: Dependency Injection with AngularJS

Tags:

Are you in the market for a book on AngularJS? Here’s my review of the book Dependency Injection with AngularJS, written by Alex Knol and published by Packt Publishing.

Disclaimer: I was sent a free copy of the book for review purposes.

About the book

The backside of the book explains you’ll learn a variety of topics about Angular, such as creating reusable components, how to use Jasmine or Protractor for testing, and application architecture related topics.

The covered topics include AngularJS controllers, filters, directives and modules. There’s also chapters on testing, AngularJS architecture and larger application architecture.

The book is not very long: at 66 pages and all the topics it covers, there’s not a whole lot of space to go into much detail.

The material of the book and printing quality itself is good as you would expect from a well established publisher like Packt. There was a high number of typos and other small mistakes, but I’m sure most of them will be sorted in later printing rounds and on the ebook version.

The good stuff

AngularJS is not a simple topic, yet despite the low page count, this book covers a lot. It doesn’t go into heavy detail, but you get a decent idea of what is involved.

The book serves as a good overview of what Angular is and does. Starting from the ground up, it tells you about how to use Angular, how to structure your applications, etc.. There’s a chapter about how to build code that’s loosely coupled and easy to test, and it also talks about unit testing different angular components. There’s also a chapter on using Angular’s new end-to-end test runner, Protractor, but the chapter is already a bit outdated as Protractor is under heavy development.

One particular thing I learned from this book was the ability to change Angular’s template interpolation characters, which I had no idea you could do. It also mentions ngMin which can be a very nice tool to use in Angular projects.

The final chapter in the book discusses a variety of ways you can use to structure your code in large applications, which can be quite useful.

The not-so-good stuff

The book is very high-level and it doesn’t go very in-depth on any of the topics. As a result, it sometimes lacks details that someone new to AngularJS would find useful.

It uses the word “magic” to describe some things, which in my opinion is a sign that maybe it would be a good idea to explain what the “magic” really is, especially in a book that seems to be oriented towards beginning Angular developers. It also is a bit inconsistent in its use of terminology, such as directives/attributes/”pairs” and things such as double quotes vs single quotes in code.

Also as a result of lack of detail, it sometimes feels like the book jumps around a bit. For example, in the chapter about Jasmine testing, it doesn’t really explain what matchers are, yet it goes straight into implementing a custom matcher.

The verdict

I have a bit mixed feelings about this book.

On one hand, it serves as a very good high-level overview of the AngularJS library and what is involved in developing applications using it. It even touches other topics, such as testing and architecture, which are very important in longer running projects.

But on the other hand, it lacks detail and doesn’t really explain anything in depth. It can be a bit vague in places, and even though the name is “Dependency Injection in AngularJS”, it really doesn’t talk about how that works in detail either.

I personally would have enjoyed a book with more detail, but depending on what you’re looking for, this could be a decent book.

So… should I buy it?

If you’re a developer is interested in AngularJS (or similar libraries), with a decent JavaScript background… this could be a book for you. It gives you a good overview of AngularJS and the things it does, but you will need to actively go out and learn more from other sources. The book gives you a good starting point in learning more about Angular, and in some cases, it will even provide you with links to pages where you can go and do that about the topics in question.

However, if you’re a developer that’s completely new, or perhaps looking for a “one stop source” for everything Angular.. you may be slightly disappointed. This book doesn’t really have all the details you would want, and you’ll need to consult the AngularJS documentation for those.

For developers who are already familiar with Angular, the book doesn’t have much to offer. I’ve used Angular a lot, and although there were some insights for me in the book, overall it’s probably not going to be worth it.

You can buy the book directly from Packt, or from Amazon.