You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which @angular/* package(s) are relevant/related to the feature request?
forms
Description
Hello, I just tried to change a FormGroup I had to a FormArray because it only contains one type of text input, but 1..N of those.
The background is that I want to check if at least one of the existing FormControls in that FormGroup/FormArray has a value and thus validate the FormGroup/FormArray. Users can add or remove FormControls in that array as long as at least one exists.
So, what I had before:
<form[formGroup]="myFormGroup">
It would've become:
<form[formArray]="myFormArray">
However, the only possible thing I found is
<form[formArrayName]="???">
But myFormArray doesn't have a name by itself. It could only be found via name if it's inside a FormGroup.
Proposed solution
Please make it possible to reference a FormArray in e.g. a <form> element because FormArrays natively also support validation etc.
(Same goes for UntypedFormArray, by the way.)
Alternatives considered
As far as I know, the current state of things means I'd have to put myFormArray inside a FormGroup with only one element (it being the FormArray), which seems really clunky to me.
The text was updated successfully, but these errors were encountered:
Which @angular/* package(s) are relevant/related to the feature request?
forms
Description
Hello, I just tried to change a FormGroup I had to a FormArray because it only contains one type of text input, but 1..N of those.
The background is that I want to check if at least one of the existing FormControls in that FormGroup/FormArray has a value and thus validate the FormGroup/FormArray. Users can add or remove FormControls in that array as long as at least one exists.
So, what I had before:
It would've become:
However, the only possible thing I found is
But
myFormArray
doesn't have a name by itself. It could only be found via name if it's inside aFormGroup
.Proposed solution
Please make it possible to reference a
FormArray
in e.g. a<form>
element becauseFormArray
s natively also support validation etc.(Same goes for
UntypedFormArray
, by the way.)Alternatives considered
As far as I know, the current state of things means I'd have to put
myFormArray
inside aFormGroup
with only one element (it being theFormArray
), which seems really clunky to me.The text was updated successfully, but these errors were encountered: