implement constantA = (id: string): Observable<Array<any>>=>{
}
improve constantB = (id: string): Observable<Array<myClass>>=>{
constantA(metroId).map((x)=>{
return new myClass(
x.FacilityName,
x.ID)
};
}
export class myClass{
ID: string;
Name: string;
constructor(id: string, name: string){this.ID=id;this.Name=name;}
}
The function ConstantA produces an array of objects. This is utilized in the creation of ConstantB which generates an array of instances of myClass using the output from ConstantA.
While debugging the code, it was observed that 'x' within the map function contained the complete array from ConstantA instead of individual elements, causing properties to be inaccessible.
Is there a possible solution to convert a single Observable containing an array into an array of Observables for element processing?