【问题标题】:PouchDb Delta-pouch plugin don't update correctly in AngularJSPouchDb Delta-pouch 插件无法在 AngularJS 中正确更新
【发布时间】:2014-09-22 11:07:27
【问题描述】:

我的 Angular (Ionic) 代码通过 $index 获取数据库中的文档,打开一个带有表单以更改数据的模式,最后 delta-pouch 保存更新的文档。但是 delta pouch 并没有更新文档,而是创建了一个新文档..

$scope.editTerritory = function(index){
     $scope.modalEdit.show();
     $scope.doEditTerritory=function(territory) {
         pouch.save({
              $id: index.$id,
               name: territory.name,
               number: territory.number
                });
            };
        };

index._id 控制台日志以请求文档的 id 正确响应。领土对象也是如此。为什么 delta-pouch 创建一个新的?

【问题讨论】:

    标签: angularjs ionic-framework pouchdb


    【解决方案1】:

    这就是 delta-pouch 的意义所在——每次更新或删除都会生成一个新文档。但是,如果您遇到真正的错误,您应该将其提交到https://github.com/redgeoff/delta-pouch/issues。 delta-pouch 插件只有一周左右的时间;可能有一些错误! :)

    【讨论】:

      【解决方案2】:

      我发布了一个名为 factoryng 的一体化 angularjs 绑定,您可以使用它来将 delta 袋(或香草袋)合并到您的 Angular 代码中。让我知道你的想法!

      我建议您查看Contacts 示例,因为它演示了如何保存更改。注意:factoryng 目前可以与 delta-pouch、pouch 和 firebase 一起使用,因此您需要为您的项目指定 delta-pouch 适配器。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-05-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多