I making an Ionic 3 app. I have the following JSON object:
{
"player": {
"username": "thelegend",
"platform": "xbox",
"stats": {
"normal": {
"shots": 5,
"wins": 66
},
"hard": {
"shots": 5,
"wins": 77
}
}
}
}
I want to acces the following data from the JSON object:
stats: {normal:{ shots: "58", wins: "54"}, hard: {shots "34", wins: "43"}
This is my rest provider method in my Ionic 3 app:
getStats(){
return this.http.get(this.apiUrl).subscribe(data => {
console.log(data);
});
}
I call this method at a specific page:
ionViewDidLoad() {
this.getData();
}
getData(){
return this.results = this.rest.getStats();
}
The api is working great and I can see the data in my Chrome developer tools. Now I want to bind this data on the view like this:
<ion-card>
<ion-card-header>
Wins
</ion-card-header>
<ion-card-content>
{{results}}
</ion-card-content>
</ion-card>
When I run the app it shows [object object]. I tried {{results.player.stats}} but it didn't work.
How can I bind the stats values on my view and access this?
Kind regards