# Ionic Storage returning null

**URL:** <https://forum.ionicframework.com/t/ionic-storage-returning-null/107305>\
**Category:** ionic-v3\
**Created:** [October 2, 2017, 4:13am UTC](https://forum.ionicframework.com/t/ionic-storage-returning-null/107305 "2017-10-02T04:13:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![akshatbhargava123](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/akshatbhargava123/32/109845_2.png) [@akshatbhargava123](https://forum.ionicframework.com/u/akshatbhargava123)\
**Post date:** [October 2, 2017, 4:13am UTC](https://forum.ionicframework.com/t/ionic-storage-returning-null/107305/1 "2017-10-02T04:13:46Z")

</div>

My ionic storage returns null data to page though it actually has data, when I log in provider inside the function I am getting the correct values, but when I call it via page and use then attacher to get value, I am getting null value.

Function in provider:

```auto
  async getSavedArticles() {
    this.storage.ready().then(() => {
      return this.storage.get('savedArticles');
    });
  }

```

In my Page:

```auto
    this.storage.getSavedArticles().then((value) => {
      console.log(value);
      this.savedArticles = value;
    });

```

Please help, thanks.

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [October 2, 2017, 4:40am UTC](https://forum.ionicframework.com/t/ionic-storage-returning-null/107305/2 "2017-10-02T04:40:45Z")

</div>

Make sure you’re waiting on `storage.ready()` before trying to interact with it. I also am a huge unfan of `async`, for whatever that’s worth. I think it makes code much less readable.

---

<div class="post-metadata">

**Author:** ![mvdNL](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mvdnl/32/108998_2.png) [@mvdNL](https://forum.ionicframework.com/u/mvdNL)\
**Post date:** [October 2, 2017, 2:27pm UTC](https://forum.ionicframework.com/t/ionic-storage-returning-null/107305/3 "2017-10-02T14:27:07Z")

</div>

I don’t work with async but if you add ‘return’ before this.storage.ready() ?

```auto
async getSavedArticles() {
    return this.storage.ready().then(() => {
      return this.storage.get('savedArticles');
    });
  }

```

---

<div class="post-metadata">

**Author:** ![akshatbhargava123](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/akshatbhargava123/32/109845_2.png) [@akshatbhargava123](https://forum.ionicframework.com/u/akshatbhargava123)\
**Post date:** [October 2, 2017, 2:38pm UTC](https://forum.ionicframework.com/t/ionic-storage-returning-null/107305/4 "2017-10-02T14:38:35Z")

</div>

It won’t work as I want the promise for get method not the ready one.

---

<div class="post-metadata">

**Author:** ![SigmundFroyd](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sigmundfroyd/32/111604_2.png) [@SigmundFroyd](https://forum.ionicframework.com/u/SigmundFroyd)\
**Post date:** [October 2, 2017, 3:38pm UTC](https://forum.ionicframework.com/t/ionic-storage-returning-null/107305/5 "2017-10-02T15:38:06Z")

</div>

Yes, but returning the `ready` promise will result in it returning your `get` promise.
