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?