Skip to content

Introduce addControls and removeControls to reactive forms #49098

Closed as not planned

Description

@Harpush

Which @angular/* package(s) are relevant/related to the feature request?

forms

Description

Currently the only way to add or remove multiple controls or clear all controls from form group is through iterating. In #12747 the issue was closed due to being only a convenient way to do the same with forEach.
This issue is regarding performance. In the case of formRecord when having A LOT of form group entries doing forEach is extremely costly as each operation does quite a bit.
Those new operations will allow lightweight execution as the heavy stuff will happen once.
I can provide a performance screenshot to prove my point.

Proposed solution

Add new performant functions to reactive forms (especially for form record):
addControls
removeControls
clearControls

Alternatives considered

Currently the performance on 1000 additions or so is horrible. So either live with it or change to a simple object with form controls inside and handle everything related to the group manually which is horrible too.

Activity

  1. added this to the needsTriage milestone on Feb 24, 2023
  2. added
    feature
    on Feb 24, 2023
  3. modified the milestones: needsTriage, Backlog on Feb 24, 2023
  4. Harpush commented on Jun 28, 2023

    @Harpush
    Author

    @AndrewKushnir As this is about performance problems especially concerning formRecord - can you consider adding it? It's not just a nice utility function...

  5. deleted a comment from angular-robot on Oct 1, 2025
  6. deleted a comment from angular-robot on Oct 1, 2025
  7. deleted a comment from angular-robot on Oct 1, 2025
  8. arturovt commented on Sep 29, 2026

    @arturovt
    Contributor

    @JeanMeche this can be closed. It is new public API on FormGroup in a package that is only maintained now, and the previous request on the same ground was closed as #12747.

    The performance point has a route today: addControl and removeControl accept {emitEvent: false}, so a batch can skip the per-control update and end with a single updateValueAndValidity(). That gets the "heavy stuff happens once" behaviour the report asks for without new API.

    Signal forms removes the pattern: the field structure follows the model, so adding a thousand entries is one model update rather than a thousand control operations.

  9. JeanMeche commented on Sep 29, 2026

    @JeanMeche
    Member

    Per above.

  10. angular-automatic-lock-bot commented on Oct 30, 2026

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  11. locked and limited conversation to collaborators on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: formsfeature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions