I am trying to generate checkboxes for each day in a week. I created a string[] for the days and I loop over it to push new form controls to a form group. The looping goes in order of the array's index but the formGroup stores it by alphabetical order.
Is there any way to manipulate the order of the formGroup? I would like the form controls inside the formGroup to keep the array's order instead of being ordered alphabetically.
Example:
daysInWeek = [
'monday',
'tuesday',
'wednesday',
'thursday',
'friday',
'saturday',
'sunday'
];
this.daysInWeek.forEach((day, index) => {
console.log('day: ' + day + ' index: ' + index)
this.frequentie.addControl(day, new FormControl(false));
});
console.log(this.frequentie.controls);
OUTPUT
Above screenshot shows the controls inside my formGroup being ordered alphabetically.

