Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
provider-service.js
angular.module('myApp')
.provider('UserService', function() {
return {
this.$get = 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
You can’t perform that action at this time.