gar*_*may 2 typescript ag-grid angular
我在网格中有一个列,单击该列时我试图访问类的某些方法,但this上下文已更改且不可用。前任 -
export class PreTflGridComponent implements OnInit {
columnDefs = [
{onCellClicked: this.editCellClicked}
];
constructor() { }
method(): void {
console.log('working');
}
editCellClicked(params) {
this.method();
}
}
Run Code Online (Sandbox Code Playgroud)
错误:
ERROR TypeError: this.method is not a function
Run Code Online (Sandbox Code Playgroud)
this上下文更改后如何访问方法/属性。
请参阅下面的确切问题 https://stackblitz.com/edit/angular-vwgcc2,如果您单击 make 列并打开控制台,那么它将显示我正在伪造的错误。
| 归档时间: |
|
| 查看次数: |
7372 次 |
| 最近记录: |