Tested and added compatibility with Angular 1.2.27