Easy way to view contents of ionic-storage?

I am using ionic-storage and am having some issues with debugging. I would like to be able to view the contents of storage, but using the chrome debugger it seems like nothing shows up:

Also if I set a break point in one of my components that uses storage and try to output values (or everything using forEach) like so: this.storage.get('key').then(value=>console.log(value)), it doesn’t output anything. I’m a bit lost as to how I can check to see that certain values are being set correctly without hard coding the above into my application… This is not ideal.

1 Like

Hello, given the fate of IonicDB (abandoned), I would strongly recommend you to ask Ionic developers if they plan to maintain Ionic storage.

Have fun with Ionic,

I wouldn’t worry about that. It’s a completely different animal from IonicDB, which was a hosted service. The ionic-storage source code is fully available, and anybody could fork it. It’s largely a veneer over localforage.

OK, thanks for information Rapropos.

Using Developer Tools to look at the content of the Storage is absolutely right. Here is a screenshot how it should look like:

So I’d say something is broken with your implementation. Does your app actually store anything successfully?

1 Like

My app does sucesfully store content. When I use this.storage.forEach() to output every key, value pair I see my data. I just doesn’t appear in the debugger. Are you using the default set up or do you have some sort of configuration specified?

100% default in my app

By chance are you using cordova’s “browser” platform?

Experiencing the same thing here. Nothing shows up in the inspector, yet all the key/values are being stored somewhere. Using all defaults for Ionic Storage. Any idea where everything is getting stored?

What platform are you on?

In the browser. Using Chrome.

Using ionic serve or what exactly?

Yes, basic ionic serve on localhost

I’m on android and attempting to view the contents of storage using Chrome Debugger.

using ionic run android.

Did you also install the SQLite plugin when installing Ionic Storage?

Yes I have the ‘cordova-sqlite-storage’ plugin installed as well. Storage seems to be working with no issues, my only problem is that I cannot easily view the contents of storage for debugging.

Yesterday i was facing same issue. But today when I run ionic serve stored data appeared. Dont know exactly what the issue is. Stop ionic serve and run it again it will appear in indexedDB in chrome.

Hope this is helpful for others but not for me as I’m running an android app :frowning:

Well, If someone is having this problem yet, I solved mine just inputting a parameter in config of StorageConfig, where I was using the storage, like this:

function provideStorage7() {
  return new Storage({
    name:'dbSomething',
    driverOrder: ['indexeddb', 'sqlite', 'websql'],  /* added this line */
    storeName:'table_one'
  })
}

Hope this helps! :grinning:

Don’t follow the advice in the previous post. Angular DI manages Storage's lifecycle, not you.