I have ionic/angular project.
I make a call to external api with:
public getKeys() {
this.http.get('https://api.apify.com/v2/key-value-stores/myStorage/keys')
.subscribe(
data => this.dataKeys,
err => this.handleError(err)
);
}
My problem is that even thought i get valid response from server:
{
"data": {
"items": [
{
"key": "1",
"size": 52
},
{
"key": "2",
"size": 60
}
],
"count": 2,
"limit": 1000,
"exclusiveStartKey": null,
"isTruncated": false,
"nextExclusiveStartKey": null
}
}
it doesnt get saved to this.dataKeys. Im calling this:
ngOnInit() {
this.createStorage();
console.log(this.dataStorage);
this.getKeys();
console.log(this.dataKeys);
this.players.push(this.player);
console.log(this.players);
this.postData(JSON.parse(JSON.stringify(this.player)), "3");
this.getKeys();
console.log(this.dataKeys);
}
and all the logs from api remain undefined. Every help would be very appreciated.