How to access couchdb cross domain from angularjs


I've set up a local environment, where I load data from a json file:

var Players = $resource('data/players.json');
var players = Players.query(function(){});

And it works great.

Now I want to access a CouchDB on a different domain (, and based on the google buzz example I've tried the following, but I can't make it work:

var Players = $resource('',  
  {alt: 'json', callback: 'JSON_CALLBACK'},
  {get:     {method: 'JSON'}

var players = Players.query(function(){});

I simply receive an empty array... Any ideas?

Thanks a buch!



If you have control over the server, use CORS.

To correct your example:

var Players = $resource('',

  // These params will be set to each request (?alt=json
By : Vojta

This video can help you solving your question :)
By: admin