In my Angularjs app I'm getting this issue (No 'Access-Control-Allow-Origin) when I try to make a GET request from YouTube.
...
myServices.factory('YouTubeService', function ($resource) {
return $resource('http://www.youtube.com/oembed?url=:url', {}, {
query: { method: 'GET', isArray: true },
})
});
...
called with:
YouTubeService.query({url: url}, function(response) {
alert(response)
})
I know it's to do with making a request from a different domain but I've no idea how to get around it. There are loads of questions already on this but I can't get anything from any of them.
I have tried this in my config block:
delete $httpProvider.defaults.headers.common['X-Requested-With'];
but this doesn't do anything!