Having a UserService with the following code:
this.result = function(credentials)
{
$http.post('http://localhost:8080/user/login', credentials).then(function (status) {
return status;
});
};
And a LoginController with the following code:
$scope.doLogin = function()
{
var result = UserService.result($scope.credentials);
alert(result);
};
Why does the alert window popup before the POST is done/shown in firebug console, giving me an undefined message instead of a HTTP status code?