+ 2

Angular question

I have this function inside the service that does a http get getHeroes(): Observable<Hero[]> { return this.http.get<Hero[]>(this.url + '/HeroDetails') .pipe( tap(_ => this.log('fetched heroes')), catchError(this.handleError<Hero[]>('getHeroes', [])) ); } And on the component side, when calling the function I have getHeroes(): void { this.heroService.getHeroes() .subscribe( result => { this.heroes = result as Hero[]; } );} When displaying the heroes, they are the correct count but all the data is empty. What am I missing? Thanks!

29th Feb 2020, 5:20 PM
Cristina
1 ответ