I’m preparing a stackblitz for a problem that I have with child-parent communication, but along the way, I’ve been confronted with a different issue, namely, I’m getting the following error: No value accessor for form control with name: 'endDateFC'
. This happens also for startDateFC
.
I tried the following things from SO:
- I added
ReactiveFormsModule
andFormsModule
- I removed the duplicates of
FormsModule
. I have the import only in theapp.modules.ts
According to: No value accessor for form control
- I didn’t mix label and input. There is no name collision.
- I have all declarations, imports, etc.
formControlName
is located on the value accessor element
What is wrong with my code? Here’s the stackblitz: https://stackblitz.com/edit/primeng-calendar-v-zdd3of?file=src/app/postpone-dialog/postpone-dialog.component.ts
Advertisement
Answer
According to this thread and this one to understand, adding ngDefaultControl
next to the formcontrol name solves your problem: stackblitz fixed