I need to create a variable that stores the state of the función
I execute in the $ interval called $scope.getSignatureCallStatus();
that function executes a request that saves in a variable $scope.callStatus = res.data;
the state ...
are 3 states :
{
success
fail
hangup
}
So if the variable $scope.callStatus = 'success'
keeps that value in a new variable or that it is TRUE
, something like $scope.callStatusSucces = $scope.callStatus == 'success'
, but since it is in an interval the value changes dynamically, then I want the new variable does not change the value ...
$scope.promise = $interval(function() {
$scope.getSignatureCallStatus();
$scope.showStatus = true;
}, 2500);
This is the function $scope.getSignatureCallStatus();
$scope.getSignatureCallStatus = function() {
$http.get('url', {
params: {
param: param
}
}).then(function(res){
$scope.callStatus = res.data;
});
};