There is small correction.
What we are returning is Object[] and not Object.
The method signature is also changed as below -
I have a method which returns Observable as below-
getData(url: string): Observable<Object[]> {
return this.http.get<Object[]>(url);
}
Where the Object is like below :
{
property1 : value1
property2 : value2
property3 : "" // no value right now
}
What I want to do is :
return Observable<Object[]> (Please note same object)
Where the Object is like below :
{
property1 : value1
property2 : value2
property3 : value1 + value2; //combine property1 and property2 values
}
How can we achieve this ?
I know we have to use rxjs map operator but how do we use it ?
The url Transforming Observable with .map talks about transforming Array but not Map
How can we achieve this using Map operator on Observable ?
.map(obj => ({...obj, property3: obj[property1] + obj[property2]})