In angular I have created a service that gets the data from different service and merge the data with the first service. Here is the code
searchData(): Observable<MyData> {
const url = `${this.context}/search`;
return this.http.get<MyData>(url)
.pipe(
map((myData: MyData) => {
return this.secondService.getOtherData().subscribe((data) => {
// some manipulation
return myData;
});
}));
}
but this is showing the error
Type 'Observable<Subscription>' is not assignable to type 'Observable<MyData>'.
Type 'Subscription' is missing the following properties from type 'MyData': data, dataCount
How can i solve this?