I am currently in the process of learning Angular and trying to work with Observables. However, I am facing an issue where I cannot extract data from an Observable when it is in object form.
public rowData$!: Observable<any[]>;
UpdateGrid() {
this.rowData$ = this.http
.get<any[]>('http://localhost:8080/data');
this.rowData$.forEach(value => console.log(value));
}
When I log the output to the console, I receive the following HTTP response:
(2) [{…}, {…}]
0: {id: 1, name: 'Bob', sex: 'Male'}
1: {id: 2, name: 'Susan', sex: 'Female'}
length: 2
[[Prototype]]: Array(0)
I have tried using mapping and other methods to extract the data, but each time I end up with [object Object] displayed in the HTML.
Is there a simple way to retrieve this data? Any assistance would be greatly appreciated as I have been unable to find a solution online or make sense of the examples provided in the documentation. Thank you.