examples/code from the oReilly book angularJS