From f383a85f8ed569821ea0e929139dcd68c5541519 Mon Sep 17 00:00:00 2001 From: Kumar Damani Date: Wed, 3 Aug 2016 14:30:06 -0400 Subject: all files --- public/js/services/todoService.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 public/js/services/todoService.js (limited to 'public/js/services/todoService.js') 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 -- cgit v1.2.3