Updated for AngularJS 1.2.5