0

I'm trying to rewrite my code using factory:

My current code:

$http({ method: "JSONP", url: url}).success(function(data){
 $scope.albums = data.entries;
});

is ok

But my new code:

app.factory('Album', ['$resource', function ($resource) {
  return $resource(url, {}, {query: {method: 'JSONP', params: {}}});
}]);
...
$scope.albums = Album.get();
...

returns

XMLHttpRequest cannot load http://api-fotki.yandex.ru/api/users/ru-proton/albums/?format=json&callback=JSON_CALLBACK. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

What I do wrong?

proton
  • 193
  • 2
  • 13
  • This should help http://stackoverflow.com/questions/12066002/parsing-jsonp-http-jsonp-response-in-angular-js – b1_ Jul 29 '14 at 19:38
  • No, it can't help: I have no problem with jsonp and $http. I have problem with jsonp and $resource. – proton Jul 30 '14 at 06:33

0 Answers0