I am trying to resolve a $http get request before I return it but I seem to always get undefined result. I have spent a lot of time researching and trying different methods out and still cannot seem to solve it, can any of you see where I am going wrong?
This is the services.js file
(function() {
angular.module('Home')
.factory('HomeService', HomeService);
function HomeService($http) {
return {
getStatus: getStatus()
};
function getStatus($scope) {
$http({
method: 'GET',
url: 'http://rubynode-iot.chimera.projects.local/sparkDrivers'
}).then(function successCallback(response) {
}, function errorCallback(response) {
});
}
}
}());
This is the controller where I hope to send the resolved result.
function HomeController(HomeService) {
HomeService.getStatus;
console.log(HomeService.getStatus)
};