File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
src/app/shared/services/hero Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 1- import { Injectable } from '@angular/core' ; // because we want to be able to inject our hero service
1+ import { Injectable , Inject } from '@angular/core' ; // because we want to be able to inject our hero service
22import { Http , Response , RequestOptionsArgs } from '@angular/http' ;
33import { Observable } from 'rxjs/Observable' ;
44
@@ -9,9 +9,8 @@ import { Hero } from './hero';
99
1010@Injectable ( )
1111export class HeroService {
12- constructor ( private http : Http ) { }
12+ constructor ( private http : Http , @ Inject ( 'apiBase' ) private _apiBase : string ) { }
1313
14- private _apiBase = 'https://angular2-login-seed.herokuapp.com' ;
1514 private _heroesUrl = this . _apiBase + '/api/heroes' ;
1615
1716 getHeroes ( ) {
@@ -26,11 +25,11 @@ export class HeroService {
2625 heroes => heroes . filter ( hero => hero . id === id ) [ 0 ]
2726 ) ;
2827 }
29-
28+
3029 private handleError ( error : Response ) {
3130 // in a real world app, we may send the server to some remote logging infrastructure
3231 // instead of just logging it to the console
3332 console . error ( error ) ;
3433 return Observable . throw ( error . json ( ) . error || 'Server error' ) ;
3534 }
36- }
35+ }
You can’t perform that action at this time.
0 commit comments