2017-08-14 97 views
0

Angular 2複選框params.setValue不是函數錯誤?

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

Angular正在使用setValue()方法查找對象。它找不到它。試試這樣的:

​​3210