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?
Don't known / other
Is this a regression?
No
Description
I was trying to use the new build-in template syntax @for in one of my projects for creating dynamic form array elements. I have also added an option to delete the form array items in the code using which we can remove the items added in the form array. When I create, for example 3 items in the form array and then removing the 2nd element programatically from the list, then the last element is always getting deleted and not the one which I intended to delete.
I deleted the Sub task 2 but its showing as Sub task 3 got removed from ui. The json data however shows the form value correctly. Its mainly the ui thats causing the confusion, not sure if this is a two-way binding issue or something
Please provide a link to a minimal reproduction of the bug
There are no exceptions in the console, but the order of the element remaining after deleting isn't correct or at-least it isn't correctly displayed in the ui
Please provide the environment you discovered this bug in (run ng version)
There is an issue with using formControlName where the name doesn't change but the backing control does. There's probably an existing issue for this already but I couldn't find it.
You can work around it in two ways:
Track by control identity instead of index, using track subTask.
Use the formGroup directive instead of formGroupName using [formGroup]="$any(subTask)" (where I used the $any cast to avoid the typing issue, there may be a better alternative) as doing so does cause the formGroup binding's identity to change, similar to option 1.
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
No
Description
I was trying to use the new build-in template syntax
@for
in one of my projects for creating dynamic form array elements. I have also added an option to delete the form array items in the code using which we can remove the items added in the form array. When I create, for example 3 items in the form array and then removing the 2nd element programatically from the list, then the last element is always getting deleted and not the one which I intended to delete.I deleted the
Sub task 2
but its showing asSub task 3
got removed from ui. The json data however shows the form value correctly. Its mainly the ui thats causing the confusion, not sure if this is a two-way binding issue or somethingPlease provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-svsq3t
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: