I have a simple JSON file which returns an array of objects in format:
[
{
"id": 1,
"url": "file/abc.txt"
},
{
"id": 2,
"url": "file/def.txt"
}
]
I am accessing the service as given below:
this.http.get("json-url")
.map((response) => response.json())
.filter((file) => file.id === 1)
It doesn't work anything. However if I use mergeMap instead, it works fine.
this.http.get("api-url")
.mergeMap((response) => response.json())
.filter((file) => file.id === 1)
I have used map operator earlier and it worked. However it is not working here. Please let me know if I am mistaking anything while using map operator.
Please note- I am using angular 6.
pipeoperator, whereas earlier version allows you to directly applymapoperator on anObservable.