Calling all Angular/Javascript aficionados! I need some help with a service that makes API calls to fetch data:
app.service("GetDivision", ["$http", function($http){
this.division = function(divisionNumber){
$http.post("/api/division", {division:divisionNumber}).success(function(data){
return data;
});
}
}]);
When I try to call this service in my controller, the data doesn't reach it because the service isn't returning the value outside of the http request function. How can I make sure the data is returned properly from both the http request and the function called?