1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Angular4 - No value accessor for form control

Discussão em 'Angular' iniciado por jbtd, Novembro 2, 2024 às 05:22.

  1. jbtd

    jbtd Guest

    I have a custom element :

    <div formControlName="surveyType">
    <div *ngFor="let type of surveyTypes"
    (click)="onSelectType(type)"
    [class.selected]="type === selectedType">
    <md-icon>{{ type.icon }}</md-icon>
    <span>{{ type.description }}</span>
    </div>
    </div>


    When I try to add the formControlName, I get an error message:


    ERROR Error: No value accessor for form control with name: 'surveyType'

    I tried to add ngDefaultControl without success. It seems it's because there is no input/select... and I dont know what to do.

    I would like to bind my click to this formControl in order that when someone clicks on the entire card that would push my 'type' into the formControl. Is it possible?

    Continue reading...

Compartilhe esta Página