【发布时间】:2017-12-30 12:10:51
【问题描述】:
在我的组件中,我有一个在选择客户端时触发的 foreach 循环。在这个循环中,我必须在同一个组件中调用一个函数。
为此,我必须使用 this.functionName() 来调用该函数。但显然这在 foreach 循环中不起作用,因为“this”不再是组件本身。
有人对此有解决方案吗?
this.clientService.selectedClient.forEach(function(client) {
this.getIntake(); // not working
});
【问题讨论】:
标签: javascript angularjs angular foreach