reppners / ngx-drag-drop

Angular directives using the native HTML Drag And Drop API
https://reppners.github.io/ngx-drag-drop/
BSD 3-Clause "New" or "Revised" License
299 stars 118 forks source link

dndType not working on angular6 #47

Closed liranbi92 closed 5 years ago

liranbi92 commented 5 years ago

Hey, dndType isnt working on angular 6.

I tried to set it on the div like this: `<div class="cd" [dndDraggable]="draggable.data" [dndEffectAllowed]="draggable.effectAllowed" (dndStart)="onDragStart($event,'section')" [dndType]="section"

{{ name }}

`

and on drop tried to receive it but i always get "undefined".

reppners commented 5 years ago

dndType is for limiting where items can be dropped. If you set it on a draggable you can set the same value on a dropzone and it will only accept items with matching type.

Also in your example you bind the variable section to dndType. Is the variable defined in your component or was your intention to set the dndType to string value 'section'?

reppners commented 5 years ago

@liranbi92 I think you misunderstood the purpose of dndType. You can't receive it on drop as it is not transported in the drop event. If you need the information in the drop event it should be part of the data that you transport with dndDraggable, in your case draggable.data.

If you still need further advice feel free to reply here and I'll reopen the issue. Until then I'll close as answered.

reppners commented 5 years ago

Wait a minute.. I've misread my own stuff 😅 .. I'll try to reproduce.

reppners commented 5 years ago

Confirmed!

reppners commented 5 years ago

Well.. it works if you're using the latest version. Had misconfigured my stackblitz which used v1.0.3 but it works in v1.1.0

What version are you using?

liranbi92 commented 5 years ago

Yes its work now! thanks!

reppners commented 5 years ago

👍