ObaidUrRehman / ng-drag-drop

Drag & Drop for Angular - based on HTML5 with no external dependencies. :tada:
MIT License
239 stars 123 forks source link

Issue when item is draggable and droppable #13

Closed toanqc closed 7 years ago

toanqc commented 7 years ago

Is this feature not supported right now?

Because I marked a div as both draggable and droppable then I get the error below:

SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse () at Droppable.drop (droppable.js:51) at Wrapper_Droppable.handleEvent (/Ng2DragDropModule/Droppable/wrapper.ngfactory.js:74) at View_NavverItemComponent3.handleEvent_0 (/DashboardModule/NavverItemComponent/component.ngfactory.js:708)

Thank you!

ObaidUrRehman commented 7 years ago

Haven't actually tried doing something like this. But I'll have a look.

ObaidUrRehman commented 7 years ago

@toanqc with v1.0.0 release you can't add draggable & droppable directives to the same element but it will not work since droppable explicitly disables drag on an element.

Can you explain the use case of making an element draggable and droppable at the same time?

ObaidUrRehman commented 7 years ago

I was wondering if the new example I added is what you had in mind: http://plnkr.co/edit/ki2TgX?p=preview (See the swap list demo)

toanqc commented 7 years ago

I have a nested folder/file structure. I want to drag and drop a folder to another folder and file also is able to drag and drop into the folder. So in this case, the folder is both draggable and droppable.

ObaidUrRehman commented 7 years ago

@toanqc, in the v1.2.0 release I have removed the draggable=false attribute on droppable. Now you can easily implement the required functionality.