I'm building a custom address component. I'm using it in a component:
consumer.component.html:
<form [formGroup]="form">
<nt-address [parent]="form" fG="addrGrp" formControlName="addrGrp"></nt-address>
{{form.value | json}}
</form>
consumer.component.ts
data = {
addr1: 'Sample Address Line 1'
};
ngOnInit() {
this.form = this.fb.group({
addrGrp: this.fb.group(this.data)
})
}
nt-address.component.html:
<div [formGroup]="parent">
<div [formGroupName]="fG">
<md-input-container>
<input mdInput type="text" formControlName="addr1" placeholder="Address Line 1">
</md-input-container>
</div>
</div>
nt-address.component.ts:
export class AddressComponent extends ValueAccessorBase<any> {
@Input() parent: FormGroup;
@Input() fG: FormGroup;
}
I'm getting this error:
TypeError: control.registerOnChange is not a function