diff options
Diffstat (limited to 'public/js/services/todoService.js')
| -rw-r--r-- | public/js/services/todoService.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/public/js/services/todoService.js b/public/js/services/todoService.js new file mode 100644 index 0000000..649c61f --- /dev/null +++ b/public/js/services/todoService.js @@ -0,0 +1,16 @@ +angular.module('todoService', []) + + // use the api + .factory('Todos', ['$http', function($http) { + return { + get : function() { + return $http.get('/api/todos'); + }, + create : function(data) { + return $http.post('/api/todos', data); + }, + delete : function(id) { + return $http.delete('/api/todos/' + id); + } + } + }]);
\ No newline at end of file |
