Angular 4 个函数使用 papaparse 丢失上下文

Angular 4 function loses context using papaparse

我有以下代码

httpcsv2Array(event) {
    var gethttpcsv = 
    Papa.parse('https://docs.google.com/spreadsheets/d/e/yadyada/pub?output=csv', {
                        download: true,
                        header: true,
                        dynamicTyping: true//,
                        complete: this.importhttpcsv
            });
  }

importhttpcsv(results) {
    this.bformservice.deleteAll();

    results.data.forEach(item => {
      let tarr = item as bform;
      this.bformservice.bulkcreatebform(tarr);
    });
}

似乎 importhttpcsv 是在 papa.parse 的上下文中启动的,因为我得到了错误: 类型错误:无法读取未定义的 属性 'deleteAll'

我可以在同一个 class 的其他函数中使用 this.bformservice.deleteAll()。

我需要访问不同服务中的功能才能更新数据库。有什么解决办法吗?

谢谢

需要用Arrow function假装正确this

complete: () => { 
  this.importhttpcsv();
}