I am currently working on an Angular application that interacts with a server through RESTful requests, and receives a JSON stream response containing objects of a specific type. The interface for these objects is as follows:
export interface Personal {
theAddress: string;
theCity: string;
theState: String;
theCountry: string;
emailAddress: string;
}
Within my component code, I utilize HttpClient to make GET requests in order to populate an Observable:
people$: Observable<Personal[]>;
...
ngOnInit() {
this.people$ = this.http
.get<Personal[]>("/people/get")
.map(data => _.values(data))
.do(console.log);
}
I am seeking guidance on how to extract the data from this Observable and convert it into an array of `people` objects. While I have researched methods such as using the subscribe function on Observables, I am still uncertain about the exact implementation.
If anyone can provide assistance on how to effectively extract the received objects from the Observable and store them in an array, I would greatly appreciate it.