It appears that the API doesn't like or allows anything other then JSON_CALLBACK and so it doesn't seem to work with AngularJS in anyway. More on the issue here.
https://github.com/angular/angular.js/issues/1551
I've tried to access the api with both the lower level $http as well as $resource with no way to bypass the issues.
$http.jsonp( 'http://www.giantbomb.com/api/search/?format=jsonp&resources=game&api_key=2?callback=JSON_CALLBACK', {
params: {
query: 'Legend'
}
}).then( function ( response ) {
$scope.test = response.data;
console.log($scope.test);
});
Results in error from callback as well as
.factory('GiantFactory', function($resource) {
var base = 'http://www.giantbomb.com/api/search/?format=jsonp&resources=game&api_key=2&query=Legend?callback=JSON_CALLBACK';
return $resource(base, {},
{
get: {
method: 'JSONP'
}
}
);
});
Most API's do not behave this way. Has anyone found a work around to this with Angular? Can we get a fix?
Log in to comment