title: Get all storage keys in ionic storage
body: <p>I am new to Ionic app development and I have been following tutorials for the same.</p>
  
  <p>I have been trying to use <code>IonicStorageModule</code> but even though there are no errors while running the app in chrome browser mobile view mode, local storage keys are not being generated.</p>
  
  <p>In my <code>app.module.ts</code>, I have</p>
  
  <pre><code>import { IonicStorageModule } from '@ionic/storage';
  </code></pre>
  
  <p>Then I have the following import in <code>imports</code> array,</p>
  
  <pre><code>  imports: [
      BrowserModule,
      HttpModule,
      IonicModule.forRoot(MyApp),
      IonicStorageModule.forRoot()
    ],
  </code></pre>
  
  <p>Now, I created a service, named <code>user-settings.service.ts</code>,</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Storage } from '@ionic/storage';
  
  @Injectable()
  export class UserSettings {
      constructor(private storage:Storage){}
  
      favoriteTeam(team,tournamentId, tournamentName) {
          let item = { team: team,tournamentId : tournamentId, tournamentName : tournamentName};
          this.storage.set(team.id , JSON.stringify(item));
      }
  
      unFavoriteTeam(team) {
          this.storage.remove(team.id);
      }
  
      getAllFavorites() {
          let items = [];
          return this.storage.forEach((v,k,i) =&gt; {
              items.push(JSON.parse(v));
          }).then(() =&gt; {
              return items;
          });
  
      }
  }
  </code></pre>
  
  <p>Now in my components class, I am trying to retrieve all the favorites, but it is not working as expected:</p>
  
  <pre><code>  ionViewDidEnter() {
      this.userSettings.getAllFavorites().then((val) =&gt; {
        _.forEach(val,(v,k)=&gt; {
          this.favorites.push(v);
        });
      });
  
      console.log(this.favorites);
    }
  </code></pre>
  
  <p>Am I doing something wrong? </p>
  
  <p>How to retrieve all the key values from ionic storage?</p>
  
  <p><strong>Is this the correct way to do? Seems like lot of iterations to me.</strong></p>