2

I continue to get this error regardless of what I try.

html:

<form  id="newCommittee" [formGroup]="newCommittee" >
        <Input placeholder="Committee Name" class="col-4" formControlName="newCommitteeName"  >
</form>

ts:

import { FormsModule, FormGroup, FormControl, ReactiveFormsModule, FormBuilder } from '@angular/forms';

constructor( private fb: FormBuilder ) { 
    this.newCommittee = this.fb.group({
      newCommitteeName: new FormControl
    });
  }

Results in the error:

No value accessor for form control with name: 'newCommitteeDescription' at _throwError (forms.js:2144) at setUpControl (forms.js:2054)

Chip
  • 220
  • 5
  • 17

2 Answers2

1

your'e mixing constructor of FormGroup/FormControl and FormBuilder, choose one of them

this.newCommittee=new FormGroup({
   newCommitteName:new FormControl('value')
})

//or

this.newCommitte=this.fb.group({
  newCommitteName:['value']
})

See the docs

Eliseo
  • 50,109
  • 4
  • 29
  • 67
0

You are missing the () after new FormControl().

It should be:

constructor( private fb: FormBuilder ) { 
    this.newCommittee = this.fb.group({
      newCommitteeName: new FormControl() // HERE
    });
  }
MrRobot
  • 1,001
  • 1
  • 14
  • 34