I am using an HTTP GET request to retrieve some JSON code from my server. I store the JSON data in a variable. The JSON data only has two objects, minutes and seconds. Both objects are changing in value constantly (the JSON represents a timer). My problem is, if I interpolate the value in the HTML template, it comes out perfect! But if I try to console.log the JSON data, or store it into an array, it gives me either null, or Array, with no data in it.
this.timeService.fetchTime().subscribe(
(data) => this.timeArray = data);
console.log(this.timeService);
This is the service that retrieves my JSON data, and stores it into an already declared variable timeArray = [ ]. If I use {{timeArray.minutes}} in my HTML code, it shows up fine. How do I store timeArray.minutes into a local variable in my code?