Primeng: Dropdown form control: No value accessor for form control with name

Created on 3 Jun 2017  路  4Comments  路  Source: primefaces/primeng

[x ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior
I have a very similar validation form as seen here. But I get errors when using dropdown validation and trying to run karma tests.

I have this code

<form #formId [formGroup]="userform ... >
...
     <p-dropdown 
          ...
          formControlName="type"
          ...
     </p-dropdown>
...
</form>

When running 'npm test', which runs the angular-cli command 'ng test', i get

Error: No value accessor for form control with name: 'type'

It works fine for input tags that's using formControlName. When i remove formControlName from the p-dropdown, the tests can be executed. I cant really find the problem except for removing the formControlName on the p-dropdown, but i want validation on that data.

  • Angular version: 4.1.X
  • Angular cli version: 1.0.X

  • PrimeNG version: 4.0.X

  • Language: TypeScript 2.3.2

Most helpful comment

My bad. I did not import the DropdownModule in my spec.ts file

All 4 comments

My bad. I did not import the DropdownModule in my spec.ts file

Had same issue, thanks @mali1488 it helped me ! :)

Thanks alot @mali1488

@mali1488, I am facing same issue...if I add formControl name then it doesn't work. please let me know how did you resolve this issue. As I have already added DropdownModule in AppModule.ts and I am not using spec.ts

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gatapia picture gatapia  路  3Comments

jisqaqov picture jisqaqov  路  3Comments

garethlewis picture garethlewis  路  3Comments

cyberrranger picture cyberrranger  路  3Comments

pchristou picture pchristou  路  3Comments