Rc1 storage promise question..value always undefine


#1
let name; this.storage.get('name').then((data) => { name = data; }); console.log(name); for this example the console log will be undefined even we have data inside the storage. how can i wait for the storage to complete first before proceed to next line? this is a huge problem because i need to retrieve user data from storage before calling webservice.

#2

You can’t. You’re going to have to do whatever you need to do with your webservice inside the then. This is the entire point of asynchronous/reactive programming.