获取url 400 (错误请求)或任何获取url错误。如何忽略错误?
$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 it将得到{"error":"no exif data"}
Chrome获取错误:GET http://tratao-public.qiniudn.com/c851b00c127146997f017bb899bb9bb8.jpg?exif 400 (Bad Request)
发布于 2014-06-19 14:44:40
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);
}
}];希望这能有所帮助!
https://stackoverflow.com/questions/24300143
复制相似问题