Within my module, I have the code below:
var mod;
mod = angular.module('ajax-interceptor', []);
mod.config(function($httpProvider) {
$httpProvider.interceptors.push(["$q", function($q, dependency1, dependency2) {
return {
'request': function(config) {
//trying to update a scope variable upon request placement
return config;
},
'requestError': function(rejection) {
return $q.reject(rejection);
},
'response': function(response) {
return response;
},
'responseError': function(rejection) {
return $q.reject(rejection);
}
};
}]);
});
I am looking for a way to update a scope variable every time a request is made. How can I achieve this without injecting $scope
in the config block? This variable will be used to monitor user activity, such as automatically logging out a user if there has been no activity for 10 minutes.