当我的网站是100%jQuery时,我曾经这样做过:
$.ajaxSetup({
global: true,
error: function(xhr, status, err) {
if (xhr.status == 401) {
window.location = "./index.html";
}
}
});
Run Code Online (Sandbox Code Playgroud)
为401错误设置全局处理程序.现在,我使用angularjs $resource和$http我的(REST)请求到服务器.有没有办法类似地设置角度的全局错误处理程序?