Following the code examples in the book Build Your Own AngularJS