One of the functions in my RootCtrl is responsible for calling an http api and returning the result.
$scope.checkAccess = function(){
var result = MyService.me();
result.then(function(response){
console.log(response);
if (response.data != 'false'){
return true;
}
else{
return false;
}
});
}
However, when I attempt to execute this method in a child controller using...
var access = $scope.checkAccess();
it states that access
is undefined.
I'm puzzled as to what mistake I've made here?
This is how the Service call is structured:
me: function() {
return $http({
url: 'http://localhost:5000/api/me',
method: 'GET'
});
}