Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Conversation

carlosman
Copy link

By using the "call" version of Array.prototype.splice, using array-like
objects (objects with a length property) becomes possible.

When using ngRepeat with data from an AJAX-based backend it is possible
to delete two or more items in rapid succession and have to wait for an
AJAX web service to respond with a success or failure signal to
visually commit the deletion. In that situation, you may end up
cancelling one of the deletes and then the ngRepeat index does not
correspond with the backend structure, effectively removing the wrong
ngRepeat item because the index changed faster than the AJAX response
arrival. In such cases, using an array-like object works better.

By using the "call" version of Array.prototype.splice, using array-like
objects (objects with a length property) becomes possible.

When using ngRepeat with data from an AJAX-based backend it is possible
to delete two or more items in rapid succession and have to wait for an
AJAX web service to respond with a success or failure signal to
visually commit the deletion. In that situation, you may end up
cancelling one of the deletes and then the ngRepeat index does not
correspond with the backend structure, effectively removing the wrong
ngRepeat item because the index changed faster than the AJAX response
arrival. In such cases, using an array-like object works better.
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 41fc190 on carlosman:master into a257a20 on angular-ui:master.

@thgreasi
Copy link
Contributor

👍 Nice to have.
(Even though, I lost you somewhere in your use case scenario.)

We can merge this as soon as a test case is ready.
I'll give it a try, if I find some spare time.

@carlosman
Copy link
Author

Thank you, Thodoris.

I tried, quite unsuccessfully, to explain that using ui-sortable affects, tangentially, my need to use array-like objects with ngRepeat, for presenting web-service-based lists for which rows can be deleted via web service requests.

The need arose to make said lists drag-and-drop-sortable this time, so that made me revisit jQuery Sortable, but then I noticed this project's existence. I tried to use it and discovered that only the use of Array.splice, in the standard way, was breaking my code. That is why I decided to make my first attempt at contributing to a GitHub project.

Please, let me know if there is anything else I should be doing to make this happen.

@thgreasi
Copy link
Contributor

I gave some time in the weekend, trying to write a test case, but some issues arose.

Of you could create a jsfiddle/codepen example (or at lest provide some sample data) from your use case, then I could create the appropriate test cases and merge this into master.

Thanks for your effort till now.
Looking forward for your response.

@carlosman
Copy link
Author

I am sorry for not having answered before. I have been super busy with my current project. I also ran into issues with this. Just like you, I imagine. I had to re-implement my functionality in a different way. I am really grateful for your effort, but I simply had to move on. Thank you.

@carlosman carlosman closed this Dec 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants