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

Callback fix and code cleanup #14

Merged
merged 3 commits into from
Jun 12, 2013
Merged

Callback fix and code cleanup #14

merged 3 commits into from
Jun 12, 2013

Conversation

aloise
Copy link
Contributor

@aloise aloise commented Jun 8, 2013

It's a workaround for user dynamic callbacks bug. It preserves default callbacks and cleans some duplicate callback initialization code. Hopefully it will save a day for someone.

@nedbaldessin
Copy link

(Tested with AngularJS 1.1.5)

This indeed fixes the callback bug (if you specified a callback, the internal function being composed was never called).

But if in the callback I check the order of elements in the model, they are ordered as they were before the reordering action.

Example
Initial order: [1, 2, 3]
…drag and drop, put the third element in second position…
in update callback, output the model elements, the result is: [1, 2, 3]
…drag and drop, put the third element in first position…
result is: [1, 3, 2]
etc…

@aloise
Copy link
Contributor Author

aloise commented Jun 12, 2013

I believe it's fine. You should use the "stop" callback in your case. Update is triggered once the DOM position was changed. The angular model is updated in the "stop" callback. The same behavior was introduced in the original ui-sortable and I just follow this behavior.

@nedbaldessin
Copy link

Ah, you are right, I should have been using the "stop" callback. Thanks a lot!

ProLoser added a commit that referenced this pull request Jun 12, 2013
Callback fix and code cleanup
@ProLoser ProLoser merged commit e726c80 into angular-ui:master Jun 12, 2013
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