I have a Service which uses $resource to pull in API data. I want to included a isLoaded variable to define whether the API response has executed.
My service currently looks like this:
app.factory('PlayerService', ['$resource', function($resource) {
return $resource(
'http://api/endpoint', {player_id: "@player_id"}
)
}]);
I want to add functionality something like this (pseudocode)...
app.factory('PlayerService', ['$resource', function($resource) {
$scope.isLoaded = false;
return $resource(
'http://api/endpoint', {player_id: "@player_id"}
)
$scope.isLoaded = "true";
}]);
...but I'm struggling with the syntax. Do I need to write a separate function? Does this logic need to be contained in the controller as opposed to the service?
Any help appreciated.