2017-02-20 76 views
0

我已經成功將信息放入PouchDB,但是如何檢索數據並使用AngularJS以HTML格式顯示?從pouchdb獲取數據

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(); 

回答