updated code to angular 1.3