I am trying to display some JSON data that comes as HTTP web response, but it's not working.
Below is my http request:
nodes: any;
ngOnInit(): void {
// Make the HTTP request:
this.http.get('/assets/TEST.json').subscribe(data => {
// Read the result field from the JSON response.
this.nodes=data;
});
}
And this is the template:
<div *ngFor="let node of nodes">
<p>{{node.description}}</p>
</div>
This is my json data:
{
"id": 1,
"name": "root1",
"link": "/login"
}
This the error I get in console:
Cannot find a differ supporting object '[object Object]' of type 'root1' where root1 is a component different from the one where the request is made.
this.nodes = data.json()?data=>console.log(data), it shows the json ? @eli