import {FormGroup} from "@angular/forms";

export class FormGroupInitializer {
    public static initFormGroup(formGroup: FormGroup, model: any) {
        for (const controlName in formGroup.controls) {
            if (formGroup.controls.hasOwnProperty(controlName)) {
                formGroup.patchValue({[controlName]: model[controlName] ?? null});
            }
        }
        return formGroup;
    }
}