首页 > 解决方案 > Angular-将值传递给另一个函数?

问题描述

在我的 Angular Typescript 文件中,我有 2 个函数datalists. 我正在尝试将变量windows从函数数据传递到函数列表。

Cannot find name 'back'. Did you mean the instance member 'this.lists'?ts(2663) 尝试调用函数列表时出现错误

更新

如果我使用this.list,当我console.log(windows),它给undefined

data(less: Mark, quick: HTMLTableDataCellElement) {
  const { a,b,c } = less;
  const windows = quick.innerText;
  lists(windows);     ------>>>>> Cannot find name 'lists'. Did you mean the instance member 'this.lists'

  this.value.newLevel({a, b, c windows}).subscribe(data => {
    this.processView(data);
  })
}

lists(windows){
 console.log(windows) ---> If I use this.lists the value is undefined
}

标签: javascriptangulartypescript

解决方案


List 在同一个类中,因此您正在尝试访问对象内的函数。您必须调用 this.list 而不是调用 list


推荐阅读