【发布时间】:2023-03-17 23:49:01
【问题描述】:
来自 Angular Tour Of Heroes 教程:https://angular.io/tutorial/toh-pt4
代码:
getHeroes(): void {
this.heroes = this.heroService.getHeroes();
}
这种声明方法的语法是什么意思?
【问题讨论】:
-
具体哪一部分不明白?你读过例如typescriptlang.org/docs/handbook/functions.html?
-
这只是一个不返回任何内容 (
void) 并将属性 (this.heroes) 设置为this.heroService.getHeroes()函数返回的任何内容的方法 -
6 票否决?我不明白这样的人。这是一个可以提问的网站吗?
标签: angular typescript methods angular6 void