close

[Solved] Angular4 – No value accessor for form control

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Angular4 – No value accessor for form control in javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Angular4 – No value accessor for form control Error Occurs?

Today I get the following error Angular4 – No value accessor for form control in javascript.

How To Solve Angular4 – No value accessor for form control Error ?

  1. How To Solve Angular4 – No value accessor for form control Error ?

    To Solve Angular4 – No value accessor for form control Error You should use formControlName="surveyType" on an input and not on a div

  2. Angular4 – No value accessor for form control

    To Solve Angular4 – No value accessor for form control Error You should use formControlName="surveyType" on an input and not on a div

Solution 1

For me it was due to “multiple” attribute on select input control as Angular has different ValueAccessor for this type of control.

const countryControl = new FormControl();

And inside template use like this

    <select multiple name="countries" [formControl]="countryControl">
      <option *ngFor="let country of countries" [ngValue]="country">
       {{ country.name }}
      </option>
    </select>

Solution 2

You should use formControlName="surveyType" on an input and not on a div

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment