Skip to content

Instantly share code, notes, and snippets.

@sivaprasadreddy
Created September 5, 2014 12:10
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/42bd33585fc34b9fa6b7 to your computer and use it in GitHub Desktop.
Save sivaprasadreddy/42bd33585fc34b9fa6b7 to your computer and use it in GitHub Desktop.
service-service.js
angular.module('myApp')
.service('UserService', ['$http',function($http) {
var service = this;
this.user = {};
this.login = function(email, pwd) {
$http.get('/auth',{ username: email, password: pwd}).success(function(data){
service.user = data;
});
};
this.register = function(newuser) {
return $http.post('/users', newuser);
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment