valor-software / ng2-select

Angular based replacement for select boxes
http://valor-software.github.io/ng2-select/
MIT License
675 stars 585 forks source link

Error: No value accessor for form control with unspecified name attribute #884

Closed labyed closed 6 years ago

labyed commented 7 years ago

i checked the demo code, and used this componnet in my app (based on ng2-admin) but ijm getting this trace `core.es5.js:1084 ERROR Error: Uncaught (in promise): Error: No value accessor for form control with unspecified name attribute Error: No value accessor for form control with unspecified name attribute at _throwError (forms.es5.js:1918) at setUpControl (forms.es5.js:1828) at NgModel._setUpStandalone (forms.es5.js:4402) at NgModel._setUpControl (forms.es5.js:4388) at NgModel.ngOnChanges (forms.es5.js:4319) at checkAndUpdateDirectiveInline (core.es5.js:10812) at checkAndUpdateNodeInline (core.es5.js:12238) at checkAndUpdateNode (core.es5.js:12177) at prodCheckAndUpdateNode (core.es5.js:12704) at Object.View_UserStatisticsComponent_0.co [as updateDirectives] (UserStatisticsComponent.ngfactory.js:296) at _throwError (forms.es5.js:1918) at setUpControl (forms.es5.js:1828) at NgModel._setUpStandalone (forms.es5.js:4402) at NgModel._setUpControl (forms.es5.js:4388) at NgModel.ngOnChanges (forms.es5.js:4319) at checkAndUpdateDirectiveInline (core.es5.js:10812) at checkAndUpdateNodeInline (core.es5.js:12238) at checkAndUpdateNode (core.es5.js:12177) at prodCheckAndUpdateNode (core.es5.js:12704) at Object.View_UserStatisticsComponent_0.co [as updateDirectives] (UserStatisticsComponent.ngfactory.js:296) at resolvePromise (zone.js:769) at resolvePromise (zone.js:740) at zone.js:817 at ZoneDelegate.webpackJsonp.1056.ZoneDelegate.invokeTask (zone.js:424) at Object.onInvokeTask (core.es5.js:4140) at ZoneDelegate.webpackJsonp.1056.ZoneDelegate.invokeTask (zone.js:423) at Zone.webpackJsonp.1056.Zone.runTask (zone.js:191) at drainMicroTaskQueue (zone.js:584) at HTMLAnchorElement.ZoneTask.invoke (zone.js:490) 

​`

DanielOrmeno commented 7 years ago

Any luck with this?

rkritika commented 7 years ago

Hey. Got any solution for that ?

DanielOrmeno commented 7 years ago

For me it ended up being a missing material module, for me it was the MatSelectModule, check that you have the required material modules, i.e. MatInputModule, MatRadioModule, etc..

sks40gb commented 6 years ago

ng2-select - does not accept ngModel

EduhCosta commented 6 years ago

@sks40gb @rkritika @DanielOrmeno Add in your app.module.ts these imports.

import { NativeScriptModule } from "nativescript-angular/nativescript.module"; import { NativeScriptFormsModule } from "nativescript-angular/forms";

;)

krishnpalchouhan commented 6 years ago

same issue for me Resolution would be just removed undeclared [(ngModel)] from HTML or create variable

optimistex commented 6 years ago

HI! The component has continued developing in the fork: https://github.com/optimistex/ngx-select-ex Check the demo: https://optimistex.github.io/ngx-select-ex/ It has a lot of fixed issues. I think the issue solved too.

ali-turki commented 6 years ago

you might find the solution here. https://stackoverflow.com/questions/38958347/angular2-rc-5-custom-input-no-value-accessor-for-form-control-with-unspecified

HyungsukChoi-B2LiNK commented 6 years ago

Thank you @krishnpalchouhan I solve same issue with @krishnpalchouhan 's answer.

  1. Remove all [(ngModel)] from HTML and binding variable from JS
  2. create variable in JS
  3. create [(ngModel)] in HTML
Nejo12 commented 5 years ago

I have the same issue and the error was cause by unconsciously setting ngModel in <div>. Check if you set the ngModel on the <input>?

optimistex commented 5 years ago

@Nejo12 https://github.com/valor-software/ng2-select/issues/884#issuecomment-370137777

yugantpardeshi commented 4 years ago

I had the exact same issue. This worked for me. Import the module in your (your module here).module.ts . You have to import npm modules in the module.ts file where the component is using it.