Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed Nov 29, 2010
0 parents commit b016bd7
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions angular-couch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*!
* angular couchdb service
*
* Copyright 2010, Igor Minar
* Licensed under the MIT license.
*
* This is an almost completely incomplete couchdb service, implemented
* as thin wrapper around jquery-couch.js.
*
* Over time it might turned out to be the best couchdb adapter for angular,
* but right now it's just a proof of concept.
*
*/

/**
* angular service exposing jquery couch for DI
*/
angular.service('jQueryCouch', function() {
return $.couch;
});


/**
* angular couch service
*/
angular.service('couch', function(jQueryCouch) {
var root = this;

return {
allDbs: function() {
var dbs = [];

jQueryCouch.allDbs({
success: function(allDbs) {
angular.copy(allDbs, dbs);
root.$eval();
}
});

return dbs;
}
}
}, {$inject: ["jQueryCouch"], $creation: "eager-published"});

0 comments on commit b016bd7

Please sign in to comment.