/* There are 5 types of services: * Factory: most common. Used to share functions and objects across an app. * Value: often used, just share a value * Provider: common. Like factory, but with configuration * Constant: rarely used, to share a value within app configuration. * Service: rarely used, a ServiceService recipe (?) to share instances of methods and objects. */ angular.module("noteWrangler") // Naming the function Factory is a common convention. .factory('Note', ['$http', function NoteFactory($http) { return { all: function () { return $http({ method: "GET", url: "/notes.json", }); }, create: function (note) { return $http({ method: "PUT", url: "/notes", data: note, }); }, } }]);