I am fairly new to AngularJS and trying to get data via $resource in my service.
vetoApp.service('adminKeyService', ['$resource', function($resource) {
this.IsAdmin = function(key) {
var vetoAPI = $resource("http://localhost/mcspro/veto/api/getadminkey/", { callback: 'JSON_CALLBACK'}, { get: { method:'GET' } } );
return vetoAPI.get({ k: key});
}
}]);
My api call returns this simple JSON data:
{
"isAdmin": false
}
depending to the value of key. Now, in controller when I call this service, I get something like
d {$promise: d, $resolved: false} $promise: d $resolved: true isAdmin: false __proto__: d
My controller has following code to call the service and log it in console:
var isAdmin = adminKeyService.IsAdmin($scope.adminkey);
console.log(isAdmin);
How would I get isAdmin
value from this object?