I am thinking of using Angular2, PouchDB and Electron for my desktop application. But I couldn't find a way to consume the PouchDB APIs from Angular2. Can somebody please help me how to use the PouchDB APIs in Angular2 as a service?
Well, I think a good resource are the PouchDB Docs ... the basic steps seem to be the following:
Install the package with npm
npm install pouchdb
Import the Javascript file in your index.html
:
<script src="node_modules/pouchdb/dist/pouchdb.min.js"></script>
In your Service:
var PouchDB = require('pouchdb');
var db = new PouchDB('database name');
This is Preserver application I have build in Electron, Angular2 and PouchDB
Application www.hiteshbalar.com/preserver
Github Repo https://github.com/hsbalar/Preserver
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.