@ -1,6 +1,7 @@
|
||||
// #docregion
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Http, Response } from '@angular/http';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { Hero } from './hero.model';
|
||||
|
||||
@ -10,8 +11,8 @@ export class HeroService {
|
||||
constructor(private http: Http) { }
|
||||
|
||||
getHeroes() {
|
||||
return this.http.get('api/heroes')
|
||||
.map((response: Response) => <Hero[]>response.json());
|
||||
return this.http.get('api/heroes').pipe(
|
||||
map((response: Response) => <Hero[]>response.json()));
|
||||
}
|
||||
}
|
||||
// #enddocregion example
|
||||
|
Reference in New Issue
Block a user