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

Drop doesn't move item #144

Open
westlakem opened this issue Aug 7, 2018 · 2 comments
Open

Drop doesn't move item #144

westlakem opened this issue Aug 7, 2018 · 2 comments

Comments

@westlakem
Copy link

Please remove sections that are not required.

  • I'm submitting a ...
    [ X ] bug report
    [ ] feature request
    [ ] other

  • What is the current behavior?

Dropping an item doesn't move it

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar.
<div droppable>
  <li>
    <h1 draggable>Title</h1>
  </li>
  <h2 draggable>Subsection 1</h2>
  <img draggable src="assets/favicon.ico">
  <div draggable>
    My Text
  </div>
</div>

<div droppable>
  <h2> DROP ZONE</h2>
  <br>
  <br>
</div>
  • What is the expected behavior?

When I drag something into the drop zone it should move

  • Please tell us about your environment:
  • Angular version: 6.0.3
  • Chrome 64
@Geronimoz
Copy link

I don't think this is a bug, it is expected behaviour. You need to specify the (onDrop) event to move items between containers. See https://github.com/ObaidUrRehman/ng-drag-drop#transfer-data-via-drag-drop

@Skrigueztep
Copy link

Hi, i have a similar error; Could you help me?

My case its the following:

I take (Drag) a element of my list1 and when i (Drop) this element on list2, It isnt move & send a Error on console:

TypeError: Cannot read property 'map' of undefined
at UserDashboardComponent.push../src/app/

I have reviewed the code and it is in this segment where it marks the error:

onDropSelected(e: DropEvent){
this.productList.push(e.dragData);
this.removeItem(e.dragData, this.products);
}

onDropProducts(e: DropEvent){
this.products.push(e.dragData);
this.removeItem(e.dragData, this.productList);
}

removeItem(item: any, list: Array) {
console.log(list);
let index = list.map(e => {
return e.name
}).indexOf(item.name);
list.splice(index, 1);
}

Thanks, bros

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