Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

initial commit

  • Loading branch information...
commit b016bd786e6a7e769c5547088dbc33a29517454d 0 parents
Igor Minar authored

Showing 1 changed file with 44 additions and 0 deletions. Show diff stats Hide diff stats

  1. +44 0 angular-couch.js
44 angular-couch.js
... ... @@ -0,0 +1,44 @@
  1 +/*!
  2 + * angular couchdb service
  3 + *
  4 + * Copyright 2010, Igor Minar
  5 + * Licensed under the MIT license.
  6 + *
  7 + * This is an almost completely incomplete couchdb service, implemented
  8 + * as thin wrapper around jquery-couch.js.
  9 + *
  10 + * Over time it might turned out to be the best couchdb adapter for angular,
  11 + * but right now it's just a proof of concept.
  12 + *
  13 + */
  14 +
  15 +/**
  16 + * angular service exposing jquery couch for DI
  17 + */
  18 +angular.service('jQueryCouch', function() {
  19 + return $.couch;
  20 +});
  21 +
  22 +
  23 +/**
  24 + * angular couch service
  25 + */
  26 +angular.service('couch', function(jQueryCouch) {
  27 + var root = this;
  28 +
  29 + return {
  30 + allDbs: function() {
  31 + var dbs = [];
  32 +
  33 + jQueryCouch.allDbs({
  34 + success: function(allDbs) {
  35 + angular.copy(allDbs, dbs);
  36 + root.$eval();
  37 + }
  38 + });
  39 +
  40 + return dbs;
  41 + }
  42 + }
  43 +}, {$inject: ["jQueryCouch"], $creation: "eager-published"});
  44 +

0 comments on commit b016bd7

Please sign in to comment.
Something went wrong with that request. Please try again.