Hey folks,
I have a problem with PouchDB. It’s working fine on my iPhone/iPad devices, but it shows a blank page while developing and testing with Chrome.
I followed this instructions: http://gonehybrid.com/how-to-use-pouchdb-sqlite-for-local-storage-in-ionic-2/
Many thanks in advance,
Oliver
What does the dev tools have to say about it?
Is there an error showing up in there?
It stops loading and shows a white screen. It seems to stop after the statement let PouchDB = require('pouchdb');
If I put this line as a comment, it works fine. I also installed the typings for require
.
Thanks,
Oliver
Provide more information please.
What database adapter are u using?
Is there an error in dev toolsor an error while ts compile?
let PouchDB = require('pouchdb');
…
private _db;
initDB() {
this._db = new PouchDB("databse", {adapter: 'idb'});
}
is working for me with ionic 2 ts and pouchdb
You don’t need to require
pouch.
Instead you can import pouchDB
import * as pouch from 'pouchdb';
Hey there,
first thanks for the code.
I included everythings the way you did it, by “node install --save pouchdb
” and I also included the typings - and I get no errors, if I just do this:
import {Injectable} from '@angular/core';
import {Http} from '@angular/http';
import 'rxjs/add/operator/map';
import 'rxjs/add/observable/from';
import {Observable} from 'rxjs/Observable';
import * as pouch from 'pouchdb';
...
@Injectable()
export class SomeService {
data: any;
db: any = null;
...
}
But when I try to initialize the PouchDB - I just see that the page is loading, loading, loading… No error, but it stays a blank page that is beeing loaded.
initDB() {
this.db = new pouch('myTestDB', {});
}
Any glue what’s happening?
Thanks,
Oliver
@mhartington: Any idea what’s been happening? I need this feature urgently Sorry!
Are there any errors being printed out in the command line?
That and any errors in your editor would be the first hint of something going on.
No errors at all - I can start ionic serve and I can even package it via apps.ionic.io - it just freezes showing a white blank screen. I remove this.db = new pouch('myTestDB', {});
- ionic serve submits the changes and it works again.
There must be something going on. I’m not able to replicate this with my test. Are you sure there’s no errors?
I’m sure there’s something going on.
Where should I start - there is no error in the console of Chrome and no error on “ionic serve
”. What debugging methods are also available?
With that sample App I’ve made, are you able to run that without any issue?
I will try this and let you know!