I have a method in a service which returns an Observable. When I subscribe to the observable when I call the method in my component everything works fine and i get my account properly:
this.service.getAccountDetails(username)
.subscribe(account =>{
this.podcasts.push(account);
});
However when I tried to implement this using a pipe with a map and catchError it returns nothing.
this.service.getAccountDetails(username)
.pipe(
map(account => {
this.podcasts.push(account);
}),
catchError((error: Error) => {
//Do some error stuff
return of(null);
})
);
The method in the service I call looks like this:
getAccountDetails(u:String): Observable<Object> { }
Obviously I must have some annoying syntax error, but for the love of God I can't find it. Please help!
map()
- martin