updated for AngularJS 1.2.0