I want to display the variable x in my page using {{ }}
Coding snippet:
ionViewDidLoad() {
this.storage.get(‘savedData’).then((data) => {
this.getData(data);
});
getData(data){
var x=data[0].awb;
}
I want to display the variable x in my page using {{ }}
Coding snippet:
ionViewDidLoad() {
this.storage.get(‘savedData’).then((data) => {
this.getData(data);
});
getData(data){
var x=data[0].awb;
}
define this var global and bind
public let x : any // globaly defined
this.x = data[0].awb
{{x}}
This makes no sense, and doesn’t even compile. let
declares lexically-scoped variables, and doesn’t belong on object properties.
public x: any;
getData(data){
// If you declare var x here, it belongs to your function scope
this.x = data[0].awb;
}
html:
<p>{{x}}</p>
Thank you for reply.