I am trying to retrieve the localStorage value; however, I can’t get any value and my log looks like the following:
log is: {}
This is my code so far:
import {Storage, LocalStorage} from 'ionic-angular';
//I am storing here
this.local = new Storage(LocalStorage);
this.local.set('options', 'op2');
//In the chrome developer tools, I can see that the value was stored successfully in localStorage
//I can't see anything, when trying to retrieve the stored value
console.log('log is : '+ JSON.stringify(this.local.get('options')));
I would recommend you to first read about Promises (e.g. this article or this one) and also about asynchronous JavaScript. Moreover when you’re using an API you should learn to use its docs. IMHO it’s much more difficult for the others to help you when you don’t understand some core concepts.