note.js 644 B

12345678910111213141516171819202122
  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')
  6. .factory('Note', ['$http', function NoteFactory($http) {
  7. return {
  8. all: function() {
  9. return $http({method: 'GET', url: "/notes"});
  10. },
  11. find: function(id){
  12. return $http({method:'GET', url: '/notes/' + id});
  13. },
  14. update: function(noteObj) {
  15. return $http({method: 'PUT', url: '/notes', data: noteObj});
  16. },
  17. create: function(noteObj) {
  18. return $http({method: 'POST', url: '/notes', data: noteObj});
  19. }
  20. };
  21. }]);