-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b016bd7
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"}); | ||
|