我目前正在学习Angular2和typescript,并且这部分的angular 2文档导致了一个问题。有人可以在下面的例子中用它来解释=>吗?我在网上搜索并找到了对lambda函数和返回类型的引用,但是我找不到与=>的使用相匹配的任何内容,就像这里使用的那样。这是什么意思从angular2文档?
export class DashboardComponent implements OnInit {
heroes: Hero[] = [];
constructor(private heroService: HeroService) { }
ngOnInit() {
this.heroService.getHeroes()
.then(heroes => this.heroes = heroes.slice(1, 5));
}
gotoDetail() { /* not implemented yet */}
}
如果有人能帮助我理解这一点,我会非常感激。
试试这个:https://basarat.gitbooks.io/typescript/content/docs/arrow-functions.html –