made compatibile with Angular 1.2.x