private nodes = [];
constructor(private nodeService: NodeService) {}
this.nodeService.getNodes('APIUrl')
.subscribe((data) => {
this.nodes.push(data);
});
console.log(this.nodes)
This is my component where I get the data.
getNodes(url) {
return this.http.get(url)
.map((data) => data.json())
}
This is my service where i get my data and map it
However when i console.log(this.nodes) in my component this is my result:
[1: Array[0]]
And it is possible to see the structure of my data as shown here
So my problem is when i console.log(this.nodes[0]) in my component, I get undefined. I can't seem to access my data as I need to. Any thoughts?