-4
I’m not managing to bring the variable out of the then.
anggota: any;
ida: number;
ionViewWillEnter(){
this.storage.get('session_storage').then((res)=>{
this.anggota = res;
this.username = this.anggota.username;
this.ida = this.anggota.user_id;
console.log(this.ida);
});
console.log(this.ida);
}
In the above code the second console.log is not printing this.ida.
Yeah, you’re not gonna make it, this.storage.get() is a Promise, i.e., an asynchronous function. The second log does not yet have the result of the past!
– LeAndrade