Reactive Form: There is no FormControl instance attached to form control element with name

See original GitHub issue

Hi,

I need your help, because with my reactive form i have an error and the entire form is not initialized when i change the “object” to the form.

I load the object from our API, after that I convert the object to a FormGroup and i put it into the form. So for the first time all is fine. If i change dynamically the object loaded (before that I reset the form), I have this error:

ERROR Error: There is no FormControl instance attached to form control element with name: ‘objective’ at _throwError (forms.js:2432) at _noControlError (forms.js:2414) at QuillEditorComponent.eval [as onModelChange] (forms.js:2328) at eval (quill-editor.component.js:123) at ZoneDelegate.invoke (zone.js:388) at Object.onInvoke (core.js:4733) at ZoneDelegate.invoke (zone.js:387) at Zone.run (zone.js:138) at NgZone.run (core.js:4550) at Emitter.eval (quill-editor.component.js:122)

In my form.component.html i have this line to use quill-editor (quillEditorConfig is simply my config of the toolbar): <quill-editor [modules]="quillEditorConfig" formControlName="objective" placeholder="Describe your objectives"></quill-editor>

I have make some search and try to fix it but without success. I’m on the version 2.1.1 and i’ve try the 2.2.0, same problem for me.

So do you have some tips to help me? Thanks for your help, Fabrice

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

32reactions
KillerCodeMonkeycommented, May 24, 2018

i think there is a similar issue closed here.

i think the only way is to reinitialise the editor, because there seems to be a moment no control is connected to the formControlName.

It seems more a bug in angular for custom controls: https://github.com/angular/angular/issues/14057

but you could try to use the [formControl]="form.controls['objective']" syntax. or better work with the controls-getter 😃

2reactions
fkizewskicommented, Jun 1, 2018

Hi @KillerCodeMonkey,

I’ve keep a note to your suggestion, and i’ve just fix it on my angular app. So now i’ve use this syntax: myForm.get(‘objective’).

Thanks a lot for your help and your suggestion. Best regards, Fabrice

Read more comments on GitHub >

github_iconTop Results From Across the Web

There is no FormControl instance attached to form control ...
I solved this issue by initializing form once in the component constructor i.e. constructor() ...
Read more >
There is no FormControl instance attached to form control ...
When using ReactiveForms and we override old form group with the new one (using for example this.form = new FormGroup(...) ) an error...
Read more >
Angular reactive form for a filterable table is giving error ...
Angular reactive form for a filterable table is giving error "There is no FormControl instance attached" ... To try and provide somewhat of...
Read more >
Form on input edit throws Error: There is no FormControl ...
Error: There is no FormControl instance attached to form control element with name: 'firstname' I console log my FormGroup object formGrp ...
Read more >
FormControlName - Angular
Tracks the FormControl instance bound to the directive. ... Triggers a warning in dev mode that this input should not be used with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found