My situation involves multiple controllers that rely on my custom service which uses $http. To tackle this issue, I implemented the following solution:
.service('getDB', function($http){
return {
fn: function(){
return $http({
url: "http://example.com",
method: "GET"
});
}
}
})
.controller('myCtrl', function($scope, getDB) {
console.log(getDB.fn());
}
Upon checking the output of getDB.fn() using console.log, I noticed that it returns $promise. How can I access the response data from this?