获取网址400(错误请求)或任何获取网址错误。如何忽略错误?
$http.get(res.getQNUrl(domain, key, "exif"))
.success(function(data){
$scope.imageExifMap[key] = data
}).error(entry.onError)
例如:http://tratao-public.qiniudn.com/c851b00c127146997f017bb899bb9bb8.jpg?exif
它会得到
{"error":"no exif data"}
Chrome获取错误:GET http://tratao-public.qiniudn.com/c851b00c127146997f017bb899bb9bb8.jpg?exif 400 (Bad Request)
答案 0 :(得分:-2)
var interceptor = ['$rootScope', '$q', "Base64", function (scope, $q, Base64) {
function success(response) {
return response;
}
function error(response) {
var status = response.status;
if (status == 400) {
window.location = "/account/login?redirectUrl=" + Base64.encode(document.URL);
return;
}
// otherwise
return $q.reject(response);
}
return function (promise) {
return promise.then(success, error);
}
}];
希望这可能有所帮助!