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
307 stars 120 forks source link

Unable to add dnddrop event listener #92

Closed SwapnilGopale closed 2 years ago

SwapnilGopale commented 3 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce If possible please provide a StackBlitz based on this template https://stackblitz.com/edit/ngx-drag-drop-issue-template

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Hi,

I am new to angular and I have tried this library but there is one issue that I am not able to add dnddrop event listener from my Ts file for the dynamically created dropzone div.

`value.addEventListener("drop", function( event ) { // prevent default action (open as link for some elements) event.preventDefault(); self.onDrop(self.data[index-1].id);

                });`

here value is dynamically created dropzone.

This did not work for me

reppners commented 2 years ago

Adding event listeners manually is an anti-pattern. The directives provide events that should make it unnecessary to add classic event listeners. If you need more guidance let me know.