Today we’re covering some AngularJS books that can get you started on your path to learning how to design single-page web applications using AngularJS. While the code examples in books can sometimes become outdated, books are still valuable because they go over and explain the major concepts (directives, services, factories, unit testing, etc.) that you need when developing an AngularJS web app.
The guides on the AngularJS website are good starting points but I find that a book can go into much more detail and provide more examples that fully explore each area of the AngularJS framework. Physical books also serve as a nice break from the screen and when written well, they let you mentally figure out what the code examples will do.
“[Mastering Web Application Development with AngularJS] definitely helps a beginner and serves as a handy reference for the experienced developer. Despite having done some work on AngularJS after reading a book and online courses, this book still provided me with so much information […] that I feel I should have picked up this material first.”
— Arun Mahendrakar, 5-star review of Mastering Web Application Development with AngularJS, amazon.com
This book was recently published and has up-to-date code examples. It’s a heavy book and covers everything: directives, services, controllers. It has a nice dedicated section for defining AngularJS services and providers. It’s fantastic.
Here’s an excerpt from Chapter 9 – The Anatomy of an AngularJS App describing dependency injection:
“The place to start is to understand the problem DI sets out to solve. Some of the components in an AngularJS application will depend on others. In Listing 9-4, my controller needs to use the $scope component, which allows it to pass data to the view. This is an example of a dependency — my controller depends on the $scope component to perform its work.
Dependency injection simplifies the process of dealing with dependencies — known as resolving a dependency — between components. Without DI, I would have to locate $scope myself somehow, probably using global variables. It would work, but it wouldn’t be as simple as the AngularJS technique.
A component in an AngularJS application declares its dependencies by defining arguments on its factory function whose names match the components it depends on.”
As you can see, the explanation is quite clear, perfect for anyone new to AngularJS.
Mastering Web Application Development with AngularJS
This book gives a great overview and walkthrough of major concepts. One thing that’s impressive is that the book has unit tests for every example. Write out the code, write the unit test and run it and you can see exactly what’s going to happen.
What I really like about this book, aside from the extensive unit tests/examples, are the easy to understand explanations of core AngularJS concepts. For example, the $digest cycle and when you need to use the $apply method on scopes. If you understand them, you can improve the performance of your web app and you can avoid common mistakes.
Here’s an excerpt from Chapter 11 – Writing Robust AngularJS Web Applications, page 294:
“The idea behind AngularJS model-changes tracking mechanism is based on the observation that at the end of the day, there is a finte (and rather small) number of situations where models can change. Those include:
- XHR responses firing callbacks
- Browser’s location changes
- Timers (setTimeout, setInterval) firing the callbacks
Indeed if none of the earlier events take place (user is not interacting with a page, no XHR calls have finished, no timers firing) there is no point in monitoring the model for changes. There is simply nothing going on for a given page, the model isn’t changing, so there is no reason to re-render the DOM.
AngularJS starts its model-observing machinery if and only if it is explicitly told to do so. To bring this sophisticated mechanism to life, we need to execute the $apply method on a scope object.”
As you can see, the explanation is clear and the book is full of gems like this.
Buy Mastering Web Application Development with AngularJS now
Here’s an example of a good book that has outdated code examples. I would recommend getting this as a reference. This book is a solid reference that explains the major concepts so that you can apply them on your own.
I hope that they release a 2nd edition of the book with updated examples because O’Reilly books are usually pretty good.
Other AngularJS Books…
- AngularJS in Action
- Angularjs Web Component Development: Building, Reusing And Exporting Ui Components With Angularjs
- Instant AngularJS Starter
- Recipes with Angular.js
- ux-datagrid: a highly performant list and data grid, designed for mobile devices.
- restangular: service that makes creating proper REST APIs easy.
- angular-translate: add multiple languages and translation to your app.
- angularfire: use this library to interact with your Firebase backend database.
Find more modules on ngmodules.org
- AngularJS support in PhpStorm: autocomplete, custom directives, refactoring, routing and URL template support are now in JetBrains’ wonderful IDE, PhpStorm.
- AngularJS 2.0: implementation of the next major version is beginning, mobile-first and using ES6 (ECMAScript 6). More modularity is planned and a less complex dependency injection system is being designed.