function getItems () {
$http
.get('/someURL)
.success(function (response) {
//Function body on success
$timeout(getItems, 1000);
})
.error(function (response) {
//Function body on error
$timeout(getItems, updateDelay);
});
}
I have the following function with timeout which makes a call every sec. I want to cancel the http call if it taking more than 3-4 sec and recall the function to make the call again. Thanks in advance.