Best data persistence for Angularjs/Javascript Apps on PhoneGap? [closed] Best data persistence for Angularjs/Javascript Apps on PhoneGap? [closed] angularjs angularjs

Best data persistence for Angularjs/Javascript Apps on PhoneGap? [closed]


PouchDB dev here. Obviously I'm biased, but here's my take:

  1. The best way to get around the storage quotas in PhoneGap/Cordova is to use the SQLite plugin for iOS/Android. The performance also tends to be better, especially on Android. (Edit: in modern post-Kitkat Android, it's actually worse.)

  2. WebSQL has a nice query language, but you want to be future-proof, i.e., not chain yourself to a dead standard. There's also Windows Phone and Firefox OS to consider.

  3. So if you use PouchDB and install the PhoneGap plugin, it'll work cross-browser and you'll avoid the storage limit on iOS/Android. Win?

Also, it's my personal experience that Angular fits with PouchDB like PB&J, since Angular deals with straight-up JSON objects and so does Pouch. (Compare this to Ember and Backbone, which have custom classes that you have to export to/import from JSON – it's a little trickier.)

Good luck with whatever you choose!


You can use localForage and my implementation in angular: https://github.com/ocombe/angular-localForageOn mobile it will use either indexedDB or webSQL and the initial limit will be 50mb.The syntax will be really easy to use in your angular project.


Indexeddb - There is a shim that builds compat-layer for most major browsers. 5M limit. If I could use this on top of Sqlite that would prob be a winner for me since more standards based.

Actually, the limit for WebSQL (the layer below the shim which you'll be actually using under the hood) is *50*M. However, there's a permission request that you can use to get more storage. Additionally, this is what I would recommend for exactly the reasons you noted: standards. The rumor is that Safari 7.1 is going to ship with IndexedDB support.