I am facing an issue with my RestService where the finally clause is not getting called in the controller method, even after assuming it would be triggered on either success or failure. My current setup involves using angular 1.3.13.
var restService = {
'request': function(args) {
var deferred = $q.defer();
$http({
url: url,
withCredentials: this.use_session,
method: method.toUpperCase(),
headers: headers,
params: params,
data: data,
timeout: 20000
})
.success(angular.bind(this, function(data, status, headers, config) {
deferred.resolve(data, status);
}))
.error(angular.bind(this, function(data, status, headers, config) {
deferred.reject(data);
}
return deferred.promise;
}
'listAssignments': function(filters) {
return this.request({
'method': "GET",
'url': "/assignments/",
'params': filters
});
}
}; // end restService object
restService.listAssignments(filters)
.then(function(data) {
$log.debug("success " + data);
}, function(data) {
$log.debug("error " + data);
})
.finally(function() {
$log.debug("In finally.... calling scrollHelper");
});