Since you have [formControl]="childControl"
specified in the MyChild template, you need the FormControl specified in your MyChild class.
export class MyChild implements ControlValueAccessor { @Input() data: any; out: any; childControl = new FormControl(); fn: (value:any) => void; validateFn: any = () => {}; constructor(private _renderer: Renderer, private _elementRef: ElementRef) {} writeValue(value: any): void { this._renderer.setElementProperty(this._elementRef, 'checked', value == this._elementRef.nativeElement.value); } registerOnChange(fn: (value: any) => void) { this.onChange = fn; } registerOnTouched() {} }
However, after that you get an error that seems unrelated TypeError: v is not a function
source share