todos.js 397 B

1234567891011121314151617
  1. angular.module('todoService', [])
  2. // super simple service
  3. // each function returns a promise object
  4. .factory('Todos', ['$http',function($http) {
  5. return {
  6. get : function() {
  7. return $http.get('/api/todos');
  8. },
  9. create : function(todoData) {
  10. return $http.post('/api/todos', todoData);
  11. },
  12. delete : function(id) {
  13. return $http.delete('/api/todos/' + id);
  14. }
  15. }
  16. }]);