Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular event not work as documented #319

Closed
simobasso opened this issue Mar 24, 2015 · 8 comments
Closed

Angular event not work as documented #319

simobasso opened this issue Mar 24, 2015 · 8 comments

Comments

@simobasso
Copy link

Hi @RubaXa!

I've tried onAdd event callback but evt.item and evt.from not show up.

http://jsfiddle.net/solitary90/m5jq2wcq/

I'm doing wrong?

(I've already tried dev-branch)

@yohankoehler
Copy link

I've got the same issue, you can fix it by adding keys in the object in the _emitEvent() function in ng-sortable.js.

So the old one (line 80 from ng-sortable.js)

options[name] && options[name]({
  model: item,
  models: source && source.items(),
  oldIndex: evt.oldIndex,
  newIndex: evt.newIndex
});

and the new one

options[name] && options[name]({
  model: item,
  models: source && source.items(),
  oldIndex: evt.oldIndex,
  newIndex: evt.newIndex,
  from : evt.from,
  item : evt.item
});

.from works great but it seems tha .item is a copy of the item and not the original one

yohankoehler added a commit to yohankoehler/Sortable that referenced this issue Mar 25, 2015
Fix onAdd event callback to allow evt.item and evt.from.
@RubaXa
Copy link
Collaborator

RubaXa commented Mar 25, 2015

@RubaXa
Copy link
Collaborator

RubaXa commented Mar 25, 2015

@yohankoehler Working with DOM elements is not Angular way.

@yohankoehler
Copy link

@RubaXa You are in a directive.

@RubaXa
Copy link
Collaborator

RubaXa commented Mar 25, 2015

@yohankoehler So what? Your commit are forwarding DOM elements from directive to outside.

@yohankoehler
Copy link

@RubaXa my bad, sorry please forget this commit !!!.

@Raiseupcreativity So I guess you will have to deal with the onRemove event to retrieve the model that the item is comming from.

@RubaXa
Copy link
Collaborator

RubaXa commented Mar 25, 2015

@yohankoehler Already forgotten 🙈

@simobasso
Copy link
Author

yes but I've need access on drag-over target, but i've made another directive for that....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants