Version 1.0 - Javascript to AngularJs