8000 Allow FormArray in <form> HTML element directly · Issue #61366 · angular/angular · GitHub
[go: up one dir, main page]

Skip to content

Allow FormArray in <form> HTML element directly #61366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Panossa opened this issue May 15, 2025 · 0 comments
Closed

Allow FormArray in <form> HTML element directly #61366

Panossa opened this issue May 15, 2025 · 0 comments

Comments

@Panossa
Copy link
Panossa commented May 15, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0