How I can use storage data in http request?

#1

I cant use “ids” variable in another function. Alltimes returned as undefined. How i can use this variable. This is so important for me. Because i will use this variable at http requests.

  storageGet(){
      this.storage.get('favoriteStory').then((val) => {
      this.ids = val;
    });
  }
#2

Working fine your code…
home.ts

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Storage } from '@ionic/storage';
@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
	public ids;
  constructor(public navCtrl: NavController, private storage: Storage) {
  	// set a key/value
  storage.set('favoriteStory', 'Anime');
  }
  storageGet(){
  	 // Or to get a key/value pair
  this.storage.get('favoriteStory').then((val) => {
  	this.ids = val;
  	console.log(this.ids)
    console.log('Your favoriteStory is', val);
  });
  }
}

home.html

<ion-content padding>
  <button ion-button (click)="storageGet()">Favorite Story</button>
</ion-content>
#3

Yes this code working. But i want use “this.ids” another function. How i can do?