export class DashboardComponent implements OnInit { heroes: Hero[] = []; constructor(private heroService: HeroService) { } ngOnInit(): void { this.heroService.getHeroes() .then(heroes => this.heroes = heroes.slice(1, 5)); }}这里heroes: Hero[] = []改成 heroes: Hero[];为什么无法运行? 区别在哪?
添加回答
举报
0/150
提交
取消