user.js 536 B

1234567891011121314151617
  1. /*
  2. This is an example of how to handle ajax data calls without using NgResource
  3. This is for reference only, we favor using Note over this in the app.
  4. */
  5. angular.module('NoteWrangler').factory('User', function UserFactory($http) {
  6. return {
  7. all: function() {
  8. return $http({method: 'GET', url: '/users'});
  9. },
  10. find: function(id){
  11. return $http({method:'GET', url: '/users/' + id});
  12. },
  13. update: function(userObj){
  14. return $http({method: 'PUT', url: '/users/' + userObj.id, data: userObj});
  15. }
  16. }
  17. });