Including Indexeddb in Ionic2

I want to use angular-indexeddb or Dexie in my ionic 2 project.

How should I go about it?

Why do you prefer this over sqlite?

Maybe that’s what I’ve played with before, and thought could get it around to continue using. Will look into the sqlite.

thank

Hi Sean,

We use indexedDB in all of our projects. Just include the indexedDB polyfill from here: https://github.com/MSOpenTech/cordova-plugin-indexedDB

After that you just create your DB code as you normally would do. I’m assuming you know how to use indexedDB!!

Why are we using indexedDB over SQLite… SQLite is deprecated, indexedDB is the new kid on the block.
However, ios does not fully support it yet. The polyfill fixes 90% of the issues but it all depends on how complex your DB calls and functions are. You may be lucky and never come across any issues.

Thank you for pointing that out. Haven’t come across that yet. Will dig deeper I to it.

And yes, I’ve played with indexeddb, so will be able to take it from there.

Just wondering why sqlite in the browser is getting deprecated if not already, yet ionic out of the box supports it but leaves indexeddb behind. Unless there’s something sqlite isn’t telling us. Lol

Do you have a citation on this? Are you sure you’re not referring to WebSQL? As far as I know, SQLite is alive and well, especially in mobile device OSes such as those targeted by Ionic.

But SQLite implementation in Ionic isn’t it based in WebSQL? I mean http://ionicframework.com/docs/native/sqlite/ makes use of cordova-sqlite-storage, that uses WebSQL. Is there another way of implementing SQLite outside WebSQL? Maybe I have a confusion…

cordova-sqlite-storage just mimics WebSQL’s API, it doesn’t actually use it.

Are you sure? http://nimb.ws/8J6dzR

Your link doesn’t work for me, but yes, I’m sure:

Native interface to sqlite in a Cordova/PhoneGap plugin for Android, iOS, macOS, and Windows 10 (UWP), with API similar to HTML5/Web SQL API.

image Is that ok then?

I don’t understand what you are trying to say. Ionic-storage is a higher-level concept than SQLite or WebSQL. It can use either one of them (or IndexedDB), which is convenient when testing in a browser environment where SQLite is not available. While the SQLite cordova plugin has a similar API to WebSQL, it does not actually use WebSQL or have anything to do with it. More docs here (see the configuration section at the bottom).

Sorry, I’m not trying to say the opposite, it’s just that I don’t understand how it really works and since I saw in the browser that it’s under WebSQL db, I thought it was using it for all. Thank you for making it clear now.