I'm having this error:
ERROR Error: Must supply a value for form control at index: 1.
I'm doing an app with Angular 9, the problem is at Typescript.
The following code is working:
this.registros.controls.arrayProcedimientos.setValue(convert.arrayProcedimientos);
But if I sort the array and then do a setValue I don't know what happens but is not working, example:
convert.arrayProcedimientos.sort(function(a,b){
return a.fechaInicioProcedimiento > b.fechaInicioProcedimiento;
});
//setValue of the sorted array
this.registros.controls.arrayProcedimientos.setValue(convert.arrayProcedimientos);
psd: I tried doing a patchValue(), which it doesn't throw an error, but the problem is that the object is an array of arrays. So doing a patchValue works nice on the unique fields but on the subarrays is trolling (literally).
Thanks for your attention and help, and if you need some pictures or whatever feel free to ask.
Great community :)