Re-implementing  with angular.js