in our project, we have Form that have specific field ID's (for example date,width,height). This form is visible on button click. What i want is to have new form every time i click to this button. So in final view i will have for example 5 forms (5 times button clicked), but with the same keys (date,witdh,height) where every key should have different values for each form.
After that, can i every form submit on enter and validate each form as independent instance with only key values dedicated to the specific form instance ?
Thank you for your ideas and replies.
Sure. You just need a FormArray
and inside you will have multiples of the same FormGroup
.
https://angular.io/api/forms/FormArray
this.arr = new FormArray([
new FormGroup(this.makeFormGroup()),
]);
And add a new formGroup
on button push:
this.arr.push(this.makeFormGroup());
Might be easier with a https://angular.io/api/forms/FormBuilder;