Persistent data with no user session

Hi guys, i’m trying to make an app for a congress based on the ionic-conference-app template, i’ve a problem with the “favorites”, they work perfectly but when I close the app on a mobile or reload it in a browser, there is no more favs.
I want to save them but with no user session, it just change something on the app on each phone to remember favs.
I try things with ionicStorage but it doesn’t work and I don’t see how can I do to save them after app closing, here is the repository of the theme :

If somebody can help me, it will be very cool !
Adrien :slight_smile:

definitely give ionicStorage another go! all your answers are there. storage.set() and storage.get() those favorites.

Yes, i try with storage.set() and storage.get(), here is the code :

addFavorite(slidingItem: ItemSliding, sessionData: any) {

    if (this.user.hasFavorite( {
      this.removeFavorite(slidingItem, sessionData, 'Cette session est déjà dans vos Favoris');
    } else {
      // remember this session as a user favorite

      let alert = this.alertCtrl.create({
        title: 'Favoris ajouté',
        buttons: [{
          text: 'OK',
          handler: () => {
      // now present the alert on top of all other content
    }'Favs').then((data:any[]) => {
      if(data != null)
        data.push(sessionData);'Favs', data);
        let array = [];
        array.push(sessionData);'Favs', array);


but I have this error : "Uncaught (in promise): TypeError: data.push is not a function. (In ‘data.push(sessionData)’, ‘data.push’ is undefined)"
I don’t know how to solve it

I’m having similar issues right now

PLEASE STOP ABUSING any! Don’t type that word in your code. Ever. Enable noImplicitAny in your tsconfig.json so you don’t accidentally do it.


HI @wowadrien

Did you solved this? Can you share your code?