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
{{ message }}
Repository navigation
Introduce addControls and removeControls to reactive forms #49098
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.
Reacted by Thomas Orlowski, Harpush, Samuel Fernández and Totati
@AndrewKushnir As this is about performance problems especially concerning formRecord - can you consider adding it? It's not just a nice utility function...
@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.
Activity
Harpush commentedon Jun 28, 2023
@AndrewKushnir As this is about performance problems especially concerning formRecord - can you consider adding it? It's not just a nice utility function...
arturovt commentedon Sep 29, 2026
@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.
JeanMeche commentedon Sep 29, 2026
Per above.
angular-automatic-lock-bot commentedon Oct 30, 2026
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.