parent
79dc1f2dc8
commit
350dadb63e
|
@ -17,7 +17,7 @@ export class HeroService {
|
|||
private headers = new Headers({'Content-Type': 'application/json'});
|
||||
// #enddocregion update
|
||||
// #docregion getHeroes
|
||||
private heroesUrl = 'app/heroes'; // URL to web api
|
||||
private heroesUrl = 'api/heroes'; // URL to web api
|
||||
|
||||
constructor(private http: Http) { }
|
||||
|
||||
|
@ -33,8 +33,8 @@ export class HeroService {
|
|||
.catch(this.handleError);
|
||||
// #enddocregion catch
|
||||
}
|
||||
// #enddocregion getHeroes
|
||||
|
||||
// #enddocregion getHeroes
|
||||
getHero(id: number): Promise<Hero> {
|
||||
return this.getHeroes()
|
||||
.then(heroes => heroes.find(hero => hero.id === id));
|
||||
|
@ -71,11 +71,11 @@ export class HeroService {
|
|||
}
|
||||
// #enddocregion put, update
|
||||
|
||||
// #docregion handleError
|
||||
// #docregion getHeroes, handleError
|
||||
private handleError(error: any): Promise<any> {
|
||||
console.error('An error occurred', error); // for demo purposes only
|
||||
return Promise.reject(error.message || error);
|
||||
}
|
||||
// #enddocregion handleError
|
||||
// #enddocregion getHeroes, handleError
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue