I've managed to get this code working, but I'm convinced there's a more streamlined approach using rxjs. Can anyone shed some light on how I can simplify this? The main challenge here is that I need to invoke a custom constructor for each item in the array before returning it to the subscriber. (Running Angular 8.2.3, Typescript 3.5.3, and rxjs 6.4.0)
fetchItems() : Observable<Object>{
const apiUrl = `${this.baseUrl}/items`;
return this.http.get<Array<Item>>(apiUrl).pipe(
map((itemList) => {
itemList.forEach(function(item, index, array) {
array[index] = new Item(item);
});
return itemList;
}));
}