Call a function inside ngFor in angular2

后端 未结 9 1840
眼角桃花
眼角桃花 2020-12-06 05:08

Hello I am using Angular2 and wanted to fetch the server and get some values for each ID I get inside ngFor.

9条回答
  •  攒了一身酷
    2020-12-06 05:56

    Component({
        selector:'heroes',
        template: `
        
    Name
    {{hero.name}}
    ` }) export class Heroes { heroes = HEROES; trackHero(index, hero) { console.log(hero); return hero ? hero.id : undefined; } }

提交回复
热议问题