Created
January 9, 2017 18:16
-
-
Save Ruivilela/b8de26425d40c2e62ccf56fb1d43aae8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Injectable() | |
| export class PokedexService { | |
| private baseUrl: string ='https://pokeapi.co/api/v2/'; | |
| constructor(private http: Http) { } | |
| getPokemon(index:number) : Observable<Pokemon> { | |
| return this.http.get(`${this.baseUrl}pokemon/${index}`) | |
| .map((result:Response) => result.json()) | |
| .map((res) => {return new Pokemon(index, res.name, res.sprites.front_default)}) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment