Skip to content

Instantly share code, notes, and snippets.

@sivaprasadreddy
Created September 5, 2014 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sivaprasadreddy/746449a4623d12cf37d1 to your computer and use it in GitHub Desktop.
Save sivaprasadreddy/746449a4623d12cf37d1 to your computer and use it in GitHub Desktop.
TodoService-1.js
var myApp = angular.module('myApp');
myApp.factory('TodoService', function($http){
return {
loadTodos : function(){
return $http.get('todos');
},
createTodo: function(todo){
return $http.post('todos',todo);
},
deleteTodo: function(id){
return $http.delete('todos/'+id);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment