I'm want to use Angular 2/Typescript with PouchDb and PouchDb-Find with a project generated with Angular-cli (which is now webpack based.) PouchDb gets wired in with a simple import statement.
import * as PouchDB from 'pouchdb'
var commonDb = new PouchDB(this.commonDbUrl) ;
console.log("commonDb",commonDb) ;
// .getIndexes() is from pouchDb.find. I don't know what the import for it is
commonDb.getIndexes().then(function (result) {
console.log("GetIndexes.Success",result) ;
}).catch(function (err) {
console.log("GetIndexes.Failed",err) ;
});
The new PouchDb works, the commonDb.getIndexes does not. I've tried many variations on import * as pouchfind from 'pouchdb-find'
to no avail.
How do I import the PouchDb-Find module?
This works for me.
Install npm packages.
npm install --save pouchdb-browser
npm install --save pouchdb-find
and wrote this code
import PouchDB from 'pouchdb-browser';
import PouchDBFind from 'pouchdb-find';
PouchDB.plugin(PouchDBFind);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With