Fix support angular 1.3 x

Huge refacto to refresh this old code a little...