How to store local storage value in ionic to global variable in order to display it in a page


#1

Code snippet:
this.storage.get(‘savedData’).then((data) => {
console.log(data[0].awb);
});

I want to display data in data[0].awb to the page. How to save it in a local variable in order to display the same?


#2
var_name:any;  //declare variable globally.

this.storage.get(‘savedData’).then((data) => {
console.log(data[0].awb);
this.var_name = data[0].awb
});

// on html page you can directly access the varible {{var_name}}


#3

Thank you Rupnesh it worked.