I use Ionic Framework and i try to display data from pouchdb.
I call the readParcelle function from ionViewWillEnter then i have this error : TypeError: Cannot set property 'items' of undefined
readParcelle() {
this.parcelles = new PouchDB('parcelles');
//Get parcelles from PouchDB
this.parcelles.allDocs({
include_docs: true
}).then(function (result) {
var items= [];
this.items = result;
}).catch(function (err) {
console.log(err);
});
}
ionViewWillEnter() : void
{
this.readParcelle();
}