1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How to get the position after drop with cdkDrag?

Discussão em 'Angular' iniciado por Michele mpp Marostica, Setembro 30, 2024.

  1. Hi I need to be able to drag and drop some html elements but I need to know the end position of the drop.

    using the cdkDrag directive I see from the docs that there's an event cdkDragEnded.

    This is my template:

    <div cdkDrop>
    <div cdkDrag (cdkDragEnded)="dragEnd($event)">
    ...other stuff
    </div>
    </div>


    The callback is:

    dragEnd(event: CdkDragEnd) {
    console.log(event);
    }


    In the console I found what I need but it is a private property of the event event.source._dragRef._passiveTransform and I get the error message when I compile.

    Do you know if such data or something else that I can use is exposed somehow?

    Continue reading...

Compartilhe esta Página