I want to pass URL besides getting its response data in next pipable operator of RxJS. What do you think is the smartest way to achieve this? Thanks in advance.
Here is an example. https://stackblitz.com/edit/angular-rxjs-passing-data-to-next-operator-question
I tried some operators, but I couldn't find right one.
(Actually, I don't even know why passing function which returns observable to mergeMap
results in getting data as parameter of function in next operator...)
from([
'https://jsonplaceholder.typicode.com/posts',
'https://jsonplaceholder.typicode.com/comments',
'https://jsonplaceholder.typicode.com/albums',
])
.pipe(
mergeMap(url => this.getData(url)),
tap(posts => console.log(posts[0])), // I want to get url too here!!
).subscribe();
I expect to get url and its response data as pair in pipable operator.