Last active
August 29, 2015 14:15
-
-
Save andyczerwonka/4761d372eaece5bef0a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
freezeApp.controller('UserController', function UserController($scope, userService) { | |
$scope.update = function() { | |
userService.update($scope.user).success(function() { | |
// it worked!! | |
}); | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
freezeApp.service('userService', function userService($http) { | |
findAll = function() { | |
return $http.get('/api/users'); | |
}; | |
findById = function(id) { | |
return $http.get('/api/users/' + id); | |
}; | |
create = function(user) { | |
return $http.post('/api/users', user); | |
}; | |
update = function(user) { | |
return $http.put('/api/users', user); | |
}; | |
delete = function(id) { | |
return $http.delete('/api/users/' + id); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure this works, I'm just trying to show an example.