Fix for Angular 1.2.22+

This is a fix so that it works in Angular 1.2.22+ as per http://stackoverflow.com/a/22658709/150953