I've the following module:
var mod;
mod = angular.module('ajax-interceptor', []);
mod.config(function($httpProvider) {
$httpProvider.interceptors.push(["$q", function($q, dependency1, dependency2) {
return {
'request': function(config) {
//want to update a scope variable when a request is placed
return config;
},
'requestError': function(rejection) {
return $q.reject(rejection);
},
'response': function(response) {
return response;
},
'responseError': function(rejection) {
return $q.reject(rejection);
}
};
}]);
});
I want to to update a scope variable whenever a request is placed. How can I do that? I can't inject $scope in the config block. I'll use this variable to keep track the activity of the user, like a user not requesting for 10 min the user will be forcefully logged out.