问题
I have get a request from an API, some times I would get the EXIF information, but sometimes I will get error message {"error":"no exif data"}
How can I hide this error message.
In chrome, the error is 400 (Bad Request)
$http.get(res.getQNUrl(domain, key, "exif"))
.success(function(data){
$scope.imageExifMap[key] = data
}).error(function(data,status,headers,config){})
回答1:
The error message you mentioned above is browser specific. It is a browser logging functionality.
Well there is a workaround(not a solution since its not a problem) for it. I would not recommend it since its a built-in browser functionality you are trying to suppress from doing the task it is meant to do, but if that is what you want then here are couple of ways to achieve it.
Using a regular expression filter like so
^(?!.* 404 \(Not Found\))(?!.*[file name])
Using a Log filter like so
I have not explained it much because there is already an SO question that explains these in detail.
Please refer this SO for detailed explanation regarding the above mentioned workarounds.
来源:https://stackoverflow.com/questions/24950551/how-to-hide-error-message-in-angularjs-http-request