Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. heroes => {
  2. this.heroes = heroes; // tre sa ai definit in clasa heroes ca Hero[]
  3. heroes.map(hero => { // map aplica functia asta pt fiecare element din array adica fiecare hero
  4. const heroUrl = 'http://clean.com/user/' + hero.uid + '?_format=hal_json';
  5. this.http.get<Hero>(heroUrl).subscribe( //aici faci requestul si se va aplica pt fiecare erou pt ca e inauntrul map-ului
  6. currentHero => { // asta e raspunsul de la http request
  7. // aici tre sa iei currentHero.name sau ce proprietate vrei tu si sa o pui in array-ul heroes la id-ul corespunzator si gata
  8. }
  9. )
  10. })
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement