I am using some functions that send $http async request to server side.i want to call same current function after relogin user if response is "notlogin". I think i need to use promise but how?
$scope.A = function(){
$http({..,async: "isAsync",...})
.success(function (response) {
if (response.d == "notlogin") {
if ($scope.B())//call back login to refresh session
$scope.A();//repeat request if login return true
}
});
};
$scope.B= function () {
$scope.userlogin_error = "wait...";
$http({...,async: "isAsync",...}).success(function (response) {
if (response.d == "True") {
$scope.userlogin_error = "login success";
$scope.user_islogin = true;
return true;
}
});
}
B
? – dfsq Aug 23 at 15:35