When utilizing AngularJS code to send a request to the server, everything works smoothly on success. However, deliberately redirecting the request to a different domain causes the CORS problem where the error handling function is triggered but errorData is empty. While debugging in Chrome, it shows that the error function is being executed and displays the message "No 'Access-Control-Allow-Origin' header is present on the requested resource." in the console, yet I am unable to access it within the code. How can I effectively log this error?
RemoteService.doRequestPromise().then(
function(resp) {
LEService.logIt(resp);
if (status != 200) {
LEService.error(resp);
}
},
function(errorData) {
LEService.error({ 'err': errorData });
}).finally(function() {
usSpinnerService.stop('spin1');
});