# Help with LocalStorage and Storage with the ionic@beta8

**URL:** <https://forum.ionicframework.com/t/help-with-localstorage-and-storage-with-the-ionic-beta8/54408>\
**Category:** ionic-v3\
**Created:** [June 9, 2016, 11:06pm UTC](https://forum.ionicframework.com/t/help-with-localstorage-and-storage-with-the-ionic-beta8/54408 "2016-06-09T23:06:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arsene123](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/arsene123/32/102588_2.png) [@arsene123](https://forum.ionicframework.com/u/arsene123)\
**Post date:** [June 9, 2016, 11:06pm UTC](https://forum.ionicframework.com/t/help-with-localstorage-and-storage-with-the-ionic-beta8/54408/1 "2016-06-09T23:06:20Z")

</div>

hey ionic team. i need your help with LocalStorage and Storage in ionic 2. i have 3 pages,  
-the first is a list of user, (UserPage)  
-the second is this detail list of user and (UserDetailPage)  
-the last is the favorite page where i can save the favorite use. (FavoritePage)

- my code is looks like this for the first page :

Thanks and Sorry for my english. need your help please 🙂

---

<div class="post-metadata">

**Author:** ![javebratt](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/javebratt/32/104226_2.png) [@javebratt](https://forum.ionicframework.com/u/javebratt)\
**Post date:** [June 14, 2016, 4:03pm UTC](https://forum.ionicframework.com/t/help-with-localstorage-and-storage-with-the-ionic-beta8/54408/2 "2016-06-14T16:03:34Z")

</div>

> [@arsene123](#):
>
> here is my problem. how can i add detail for one user with click event on a button, to the FavoritePage and save data with the LocalStorage or Storage in ionic2

Create a function where you get the favorites from localStorage, add the new favorite and save back to localStorage.

It would look something like this:

```
addFavorite(newFavorite) {
 // This gets the favorites already stored in localStorage
  this.local.get('favorites').then( favorites => {
    this.favoriteList = JSON.parse(favorites);

    // After you get the favorites push the new favorite to the list
    this.favoriteList.push(newFavorite);

    // And then just save it back to localStorage
    this.local.set('favoriteList', this.favoriteList);
  });
}

```

Just remember, JS is async, so make sure the data is always ready before you push or set.

Cheers!
