i am trying to get the response from the server which returns something like true, false, or something else, depending on the request i do, the application i am developing is using a Restful server i created, and just for testing purposes i made it return true or false, later i will make it return proper json data.
here i am trying to get the response from this code (i am not sure how to use promises yet)
app.service('UserService', ['$resource', function($resource){
var self = this;
self.login = function(credentials){
var handler = $resource('server/web/user/access', null, {
access: {
method: 'POST'
}
});
handler.access(credentials).$promise.then(function(data){
console.log(data);
});
}
}]);
for now i am just logging what it seems to return from the server, but the log shows another promise. for now i just need to get the data so i can make the conditions, parse objects, or show data it returns from the Restful server
datais a promise, it should be a$resourceinstance. Perhaps you're mistaking it for a promise due to the$promise/$resolvedproperties it will have. See the bottom of the Usage / Returns section here ~ docs.angularjs.org/api/ngResource/service/$resource#usage