FormArray sortable example incorrect
tpetersheim opened this issue · comments
-
I'm submitting a ...
[x] bug report
[ ] feature request
[ ] question about the decisions made in the repository -
Do you want to request a feature or report a bug?
Documentation error -
What is the current behavior?
https://github.com/akserg/ng2-dnd#14-simple-formarray-sortable-with-drag-and-drop
The existing example shows[sortableData]="listOne"
-
What is the expected behavior?
It should be[sortableData]="listOne.controls"
This is not a bug, example is correct. Controls manipulations should be performed on FormArray
object, not on array of AbstractControl
in .controls
, as stated in documentation.
I made a plunker to verify and it looks like I was mistaken. Not sure what was happening in my other project but actually both seem to work.
https://embed.plnkr.co/p6Thqx0yb5AxARHeqCda/ adapted from http://embed.plnkr.co/JbG8Si
Yes, both seem to work, as .controls
is an array. It's just it's not working correctly, as FormArray
internals do not get updated when reordering .controls
directly.