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 the source of the bug?
forms
Is this a regression?
No
Description
We rely on _onCollectionChange() to notify its FormGroupDirective to re-bind its FormControlName directives, and FormGroup is smart enough to propagate its _onCollectionChange() callback so that Child FormGroups can notify too. This happens in two scenarios
When we callregisterControl (and associated methods)
The problem is with scenario 1: we may seed each child control with a default callback (an empty function) on init, but we don't propagate a new callback when we eventually bind the FormGroup to a FormGroupDirective. The child FormGroups are still working with the 'default' one. Furthermore the api is private so I don't see any way to fix this on the user side.
If we have a scenario where a child form group adds controls dynamically, and some of those controls are FormControlName directives (see stackblitz), then we fail to trigger _updateDOMValue() on the parent FormGroupDirective. The FormControlName directives are left with orphaned form controls.
Ideally, _registerOnCollectionChange() would cascade to its children (or maybe just call _setupControls() again).
Please provide a link to a minimal reproduction of the bug
Which @angular/* package(s) are the source of the bug?
forms
Is this a regression?
No
Description
We rely on
_onCollectionChange()
to notify its FormGroupDirective to re-bind its FormControlName directives, and FormGroup is smart enough to propagate its_onCollectionChange()
callback so that Child FormGroups can notify too. This happens in two scenarios_setupControl()
which binds_onCollectionChange()
to the childrenregisterControl
(and associated methods)The problem is with scenario 1: we may seed each child control with a default callback (an empty function) on init, but we don't propagate a new callback when we eventually bind the FormGroup to a FormGroupDirective. The child FormGroups are still working with the 'default' one. Furthermore the api is private so I don't see any way to fix this on the user side.
If we have a scenario where a child form group adds controls dynamically, and some of those controls are FormControlName directives (see stackblitz), then we fail to trigger
_updateDOMValue()
on the parent FormGroupDirective. The FormControlName directives are left with orphaned form controls.Ideally,
_registerOnCollectionChange()
would cascade to its children (or maybe just call_setupControls()
again).Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-iatn8h?file=src%2Fbroken-form.ts
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
No response
The text was updated successfully, but these errors were encountered: