This is what I did with PouchDB and Ionic 2 rc0.
npm install --save pouchdb
to install PouchDB
npm install --save @types/pouchdb
to install PouchDB typings
Then, in your code you have to import PouchDB:
import PouchDB from 'pouchdb';
To initialize your db:
this.db = new PouchDB( 'myDB', {adapter: 'websql'} );
If you need to synchronize your db with local CouchDB server (very useful to have a look at your PouchDB db content):
this.remote = 'http://localhost:5984/myDB';
let options = {
live: true,
retry: true,
continuous: true
};
this.db.sync( this.remote, options );
If it still doesn't work, then try:
typings install --global --save dt~pouchdb dt~pouchdb-adapter-websql dt~pouchdb-browser dt~pouchdb-core dt~pouchdb-http dt~pouchdb-mapreduce dt~pouchdb-node dt~pouchdb-replication
Good luck to you, as Ionic 2 rc0 is a nightmare to compile (build) for now...
The Ionic team is working hard to solve compilation problems, but it still sucks...