【问题标题】:Get data from pouchdb从 pouchdb 获取数据
【发布时间】:2017-02-21 01:47:34
【问题描述】:

我已成功将信息放入 PouchDB,但是如何使用 AngularJS 检索数据并以 HTML 格式显示?

var db = new PouchDB('infoDB');

function getData(){
    $.getJSON('test.json', function(data) {
    var row = data[0].Row;
    var info = [];

    db.destroy().then(function () {
        return new PouchDB('infoDB');
    }).then(function(db){
        for (var i = 0; i < row.length; i++) {
            var info = {
                _id: row[i].id,
                name: row[i].name, 
                email: row[i].email,
                age: row[i].age
            }
            db.put(info).then(function(result){
                console.log("Everything is ok!");
            }).catch(function(err){
                console.log('Oh No!');
                console.log(err);
            });
        }
    });
});
}

getData();

【问题讨论】:

    标签: javascript angularjs pouchdb


    【解决方案1】:

    从您的 pouchdb 数据库中寻找获取文档。

    在他们的网站上,他们简要解释了: https://pouchdb.com/api.html#fetch_document

    要获取特定文档,请查看 find 插件: https://nolanlawson.github.io/pouchdb-find/ 它易于使用,也适用于 Couch 2.0。

    恐怕我无法帮助您解决角度问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-03
      • 1970-01-01
      • 1970-01-01
      • 2017-10-23
      • 1970-01-01
      • 2015-02-15
      相关资源
      最近更新 更多