update code to work with angularjs 1.2.10+