I am collecting data provided by an API in JSON.
With the code below I can see that the data was collected inside Subscribe.
But outside of it, inside the .TS file itself I can not manipulate this data.
I tried to use the promise, but I do not think I used it correctly, because I also did not have a positive result.
How could I handle this data before displaying it on the screen?
getHour() {
this.hourService.getData()
.subscribe(
posts => this.posts = posts,
error => this.errorMessage = <any>error,
() => console.log(this.posts));
console.log(this.posts);
}