javascript - Angular-将值传递给另一个函数?
问题描述
在我的 Angular Typescript 文件中,我有 2 个函数data
和lists
. 我正在尝试将变量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
}
解决方案
List 在同一个类中,因此您正在尝试访问对象内的函数。您必须调用 this.list 而不是调用 list
推荐阅读
- javascript - Omnifaces beforeunload 在某些情况下不起作用
- html - 我如何在这个 div 中居中
- python - sorted() 如何对列表中的列表起作用
- c++ - 关于搜索和排序算法的问题
- python - 模板未显示在服务器上
- dart - Flutter 确实在几秒钟长的后台工作(Android 中的 Flutter AsyncTask)
- javascript - 字符串到 JSON 解析,javascript 运行时无效字符
- google-apps-script - 未使用 Google Apps 脚本在 Google 日历中添加事件描述
- gnuradio - 从源代码安装 GNU Radio 的问题
- angular - 嵌套值对象为空