X-Git-Url: https://juplo.de/gitweb/?p=examples%2Fangular-tour-of-heroes;a=blobdiff_plain;f=src%2Fapp%2Fhero.service.ts;h=f8374b1d8213f486e2fcd17edb016be04620a0c2;hp=90fa42c4eafc17eea7cebd39385df345a8e7e3ff;hb=a74bb0fa3f25f033319a4987bbec1acdc548f3dc;hpb=10071c9e2d5fefe91c5b8d9946bb964776b59c0e diff --git a/src/app/hero.service.ts b/src/app/hero.service.ts index 90fa42c..f8374b1 100644 --- a/src/app/hero.service.ts +++ b/src/app/hero.service.ts @@ -4,7 +4,7 @@ import { Hero } from './hero'; import { HEROES } from './mock-heroes'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { MessageService } from './message.service'; -import { catchError } from 'rxjs/operators'; +import { catchError, tap } from 'rxjs/operators'; @Injectable({ @@ -23,6 +23,7 @@ export class HeroService { return this.http .get(this.heroesUrl) .pipe( + tap((heroes: Hero[]) => this.log(`fetched ${heroes.length} heroes`)), catchError(this.handleError('getHeroes', [])) ); }