Need help with Ionic storage value retrieval. Why is GET2 executing before storage.get? My brain needs a tune-up, please assist.
public storageGet(key: string){
var uid = 0;
this.storage.get(key).then((val) => {
console.log('GET1: ' + key + ': ' + val);
if (val != null) { uid = val;}
});
console.log('GET2: ' + key + ': ' + uid);
return uid;
}
Output:
GET2: key: 0
GET1: key: 1