Skip to content

Angular event not work as documented #319

Closed

Description

@simobasso

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)

Activity

  1. yohankoehler commented on Mar 25, 2015

    @yohankoehler

    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

  2. added a commit that references this issue on Mar 25, 2015
    9e77780
  3. RubaXa commented on Mar 25, 2015

    @RubaXa
    Collaborator
  4. RubaXa commented on Mar 25, 2015

    @RubaXa
    Collaborator

    @yohankoehler Working with DOM elements is not Angular way.

  5. yohankoehler commented on Mar 25, 2015

    @yohankoehler

    @RubaXa You are in a directive.

  6. RubaXa commented on Mar 25, 2015

    @RubaXa
    Collaborator

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

  7. yohankoehler commented on Mar 25, 2015

    @yohankoehler

    @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.

  8. RubaXa commented on Mar 25, 2015

    @RubaXa
    Collaborator

    @yohankoehler Already forgotten 🙈

  9. simobasso commented on Mar 26, 2015

    @simobasso
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions