我之前有一些同事写的代码。我无法得到 $ injector 在这里做什么?
$httpProvider.interceptors.push(function($q, $location, $injector) {
return {
'responseError': function(response) {
if((response.status === 401 || response.status === 403) && $location.path().substring(1)!='login') {
var ModalService = $injector.get('modalService');
var modalOptions = {
headerText: 'Session Expired',
displayAction: true,
displayClose: false
};
if (!gotError){
gotError = true;
ModalService.showModal({}, modalOptions,'Your session has expired. Please login again to continue.').then(function(){
gotError = false;
window.location.reload();
var session = $injector.get('Auth');
session.clearSession(); //clearing cookies
});
}
}
return $q.reject(response);
}
};
});