I'm following an rxjs that shows how to use rxjs with http calls in angular. But when i'm,trying to use response.json in the mapping function, i've an error in the console saying that: ERROR TypeError: response.json is not a function. this is the code of my service:
mappingFn() {
return this.http
.get('https://opentdb.com/api.php?amount=10')
.pipe(map((response: Response) => response.json()))};
this is the code of the components:
this.svc.mappingFn().subscribe({
next: (res) => {
console.log('mapping:', res);
},
});
I looked on different blogs, but i couldn't find something usefull. Please help me. Thank you