Some good reads on Angular 1.x

I decided it was time to learn one of the many JavaScript SPA frameworks, and figured that it would be a good idea to have a look at Angular.

Of course there have been many posts in the past detailing problems in Angular such as this one, this one and this one. There are also a number of articles discussing the good parts of the framework such as this one and this one. There is also the rewrite as Angular 2.0 going on which seems to progressing well with its emphasis on TypeScript and ES6.

I haven’t had time to write anything large in this framework, but have been impressed with the design of the framework and the clever ideas that it incorporates. For me, it was also a chance to get to grips with modern JavaScript development using npm and the associated tools.

The first book I read was AngularJS Up & Running: Enhanced productivity With Structured Web Apps by Shyam Seshadri & Brad Green.

This book takes you through the facilities that the Angular framework offers, and is filled with examples that can be downloaded from one of the author’s GitHub repository. It starts with a quick introduction to Angular and writes a basic AngularJS Hello World. Chapter 2 goes into directives and controllers, concentrating on an app that displays a collection of data items using databinding and the ng-repeat directive. Chapter 3 covers unit testing using Karma and Jasmine. Angular, with its inbuilt dependency injection makes it easy to do unit testing of your controllers. Chapter 4 touches on Forms and Inputs, and then moves on to the subject of services which are covered in more detail in chapter 5, where the authors discuss the differences between services and controllers.

Chapter 6 covers HTTP communication with the server and Chapter 7 discusses unit testing the server calls that your application is making. Chapter 8 covers filters and Chapter 9 covers how you unit test them. Chapter 10 discusses the ngRoute module, and how it helps you implement history and SEO for your application. Chapter 11 goes into directives in more details and Chapter 12 covers how you unit test them.

Chapter 13 covers directives in more details, and covers the Angular life cycle, such as the digest cycle, in more detail. This is followed by Chapter 14 that covers end-to-end testing using Protractor, and the final chapter gives some guidelines and best practices.

I thought this book was a good introduction, and it was good having the examples to play with in a browser on my laptop. I enjoyed the details about how the framework worked at the low level, and it was good that the authors demonstrated how you might convert a downloaded JavaScript component, a slider, into an Angular component.

While I was trying to get a deeper understanding of the Angular framework, I came across this sample chapter from the book  Build Your Own AngularJS by Tero Parviainen. The chapter seemed to explain some of the details that I needed to understand Angular a bit better, so I bought the whole book. I’m very glad I did. The book is great from the point of view of understanding Angular, but also as a means of getting into JavaScript development. The author develops a variant of the Angular framework in a test driven fashion using npm and its associated libraries.

You get over a thousand pages of detailed JavaScript development which works through most of the features of Angular, starting with Scopes, which were covered in the sample chapter I linked to earlier, and moving all the way up to directives. The whole book is thoroughly interesting and the author explains the framework very well. Moreover, you can work through the examples too by downloading the code from the author’s GitHub repository.

There is really nothing like implementing something to get an understanding of how it all works. The book covers the whole dependency injection framework that underlies Angular in great detail, and mentions features like decorators that were only sparsely covered in the higher level book. The whole dependency injection idea makes the framework very customisable, and it’s great that the whole system is built upon this framework with all of the system components being made available by dependency resolution. Moreover, the Angular implementation of promises was much more understandable when we got into the low level implementation details – particularly promise rejection, and the underlying implementation of deferreds. I can’t recommend this book enough.

There are also a number of good Angular podcasts around including Angular Air and Adventures in Angular. And for a very brief introduction there’s Dan Wahlin’s AngularJS in 20 minutes.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s