import { Component } from '@angular/core';
import { GridOptions, RowNode } from 'ag-grid/main';
import { ICellRendererAngularComp } from 'ag-grid-angular';
@Component({
selector: 'qrp-drop-down-selector',
template: `
<input type="checkbox" [checked]="params.value" style="margin-top: -6px;" (change)="params.setValue($event.target.checked ? true : null)">
`
})
export class QrpDropdownEditorComponent implements ICellRendererAngularComp {
private params: any;
agInit(params: any): void {
this.params = params;
}
}
我创造了这种组件。但是当我把复选框错误 self.context.params.setValue不是一个函数我到底错了什么?
答案 0 :(得分:0)
Angular正在使用setValue()方法查找对象。它找不到它。尝试这样的事情:
@Component({
selector: 'qrp-drop-down-selector',
template: `
<input type="checkbox" [checked]="params.value" style="margin-top: -6px;" (change)="setValue($event.target.checked ? true : null)">
`
})
export class QrpDropdownEditorComponent implements ICellRendererAngularComp {
private params: any;
agInit(params: any): void {
this.params = params;
}
setValue(val: boolean) {
this.params = val;
}
}