I want to get the data outside the function.
Here is my controller code:
vm.someVar = "";
selfprofileSrvc.GetPrfInfo(memId,function (response, status) {
vm.someVar = response;
alert(vm.someVar);
});
Service:
Service:
this.GetPrfInfo = function (memberId, funCallBack) {
$http({
method: "GET",
url: "http://my.com/api/profile/GetProfileInfo/" + memberId,
}).success(function (response, status) {
funCallBack(response, status);
}).error(function (reason, status) {
alert("Something went wrong!");
});
}
In the above code I am getting data when the alert is in function but outside the data is empty.