Is it possible to automatically generate a FormGroup from a Model? If I have a Model with multiple Properties:
Model: Person
firstName: string,
lastName: string,
street: string,
country: string
....
And I would like to create a basic FormGroup based on it:
Form: FormGroup
firstName: FormControl,
lastName: FormControl,
street: FormControl,
country: FormControl
....
It feels cumbersome to me to manually specify a FormControl / FormGroup / FormArray for each property in the Model:
formBuilder.group({
firstName: person.firstName,
lastName: person.lastName,
street: person.street,
country: person.country,
...
});
Every time the Backend API changes, I need to update both the model and the form mapping. Is there a tool or generator available that can automate the creation of a FormGroup and its mapping?