akserg / ng2-dnd

Angular 2 Drag-and-Drop without dependencies
MIT License
838 stars 251 forks source link

FormArray sortable example incorrect #237

Closed tpetersheim closed 6 years ago

tpetersheim commented 6 years ago
loudandwicked commented 6 years ago

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.

tpetersheim commented 6 years ago

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

loudandwicked commented 6 years ago

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.