Hello
I am still trying to call an API using angular's $http, but so far I've been unsuccessful ( in IE, it works fine in Chrome and FF )
This is my code
$http({
url: 'path-to-my-api/myapi',
method: 'GET',
withCredentials: true,
dataType: 'json',
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Credentials':true,
//'Access-Control-Allow-Headers':'X-Requested-With',
'Access-Control-Allow-Methods': ['GET', 'OPTIONS']
}
}).then( function( result ){
console.log( 'success');
}, function( error ){
console.log( error );
});
On top of the headers, I got the following inside config
myApp.config(['$httpProvider', function($httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
}
]);
So, why is that IE still shows me an error ( a 403 Forbidden to be more precise ).
What is the official angular way to make api calls in IE?
PS: I've tested my code in several IE versions, including the latest 11, 10 and 9, but it still doesnt work
The errors ( or warnings ) that I get are the following:
Thanks