After the Angular 2 Tour of heroes tutorial, I found myself wondering how I would "get the heroes" if I were using a REST api.
Given that I have an API running on http://localhost:7000/heroes
that would return the "mock-heroes" list of JSON, what is the minimum I need to do to make this "solid"?
I'm as far as understanding I should put it in hero.service.ts
; particularly in:
@Injectable()
export class HeroService {
getHeroes() {
return Promise.resolve(HEROES);
}
}
But I'm stuck on how to do this at all using a http GET, let alone do it nicely/with style.