Taken from the Angular.JS Tutorial.