79822462

Date: 2025-11-17 15:22:06
Score: 2
Natty:
Report link

NOTE: Only is a comment about the solucion of Naren, not the solución, but I feel that it's not clear if I use a comment.

@Naren, it's not necesary convert to FormControl an abstractControl if you indicate in the function if the FormArray is a FormArray of FormControls (use FormArray<FormControl>) or FormArray of FormGroups (use FormArray<FormGroup>). I think remember that this works on Angular 19 but not pretty sure (time pass so quickly...)

In this case is a FormArray of FormControls, so:

getDates(attendanceForm: AbstractControl<any>): FormArray<FormControl> {
    return attendanceForm.get('dates') as FormArray<FormControl>;
  }

Now you can use in .html directly [formControl]=date

@for(date of getDates(attendanceFormGroup).controls;let idx=$index;track idx) {
     ...
     <input [id]="'lessonTitle' + i" type="text" [formControl]="date" >
}
Reasons:
  • Blacklisted phrase (2.5): solucion
  • Blacklisted phrase (3): solución
  • Whitelisted phrase (-1.5): you can use
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Naren
  • High reputation (-2):
Posted by: Eliseo