1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

control.registerOnChange is not a function

Discussão em 'Angular' iniciado por kyw, Outubro 15, 2024.

  1. kyw

    kyw Guest

    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
    ​

    Continue reading...

Compartilhe esta Página