Skip to content
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

feat(forms): Add FormArrayDirective #55880

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JeanMeche
Copy link
Member

@JeanMeche JeanMeche commented May 20, 2024

The FormArrayDirective will allow to have a FormArray as a top-level form object.

  • NgControlStatusGroup directive will be applied to the FormArrayDirective
  • NgForm will still create a FormGroup

Usage :

@Component({
  selector: 'form-array-comp',
  template: `
    <form [formArray]="form">
      @for(_ of controls; track $index) {
        <input [formControlName]="$index">
      }
    </form>`,
})
class FormArrayComp {
  controls = [new FormControl('fish'), new FormControl('cat'), new FormControl('dog')];
  form = new FormArray(this.controls);
}

Fixes #30264

@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label May 20, 2024
@ngbot ngbot bot added this to the Backlog milestone May 20, 2024
@JeanMeche JeanMeche force-pushed the feat/formArrayDirective branch 10 times, most recently from 35741f0 to 2d950c1 Compare May 20, 2024 20:30
@JeanMeche JeanMeche marked this pull request as ready for review May 20, 2024 21:40
@pullapprove pullapprove bot requested review from atscott and dylhunn May 20, 2024 21:40
The `FormArrayDirective` will allow to have a `FormArray` as a top-level form object.

* `NgControlStatusGroup` directive will be applied to the `FormArrayDirective`
* `NgForm` will still create a `FormGroup`

Fixes angular#30264
@JeanMeche JeanMeche added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: review The PR is still awaiting reviews from at least one requested reviewer area: forms detected: feature PR contains a feature commit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Supporting [formArray] without a [formGroup] parent
1 participant