Add cdkDragHandle inside component with cdkDrag in hostDirectives

Discussão em 'Angular' iniciado por Michał B, Maio 9, 2025.

  1. Michał B

    Michał B Guest

    In component I have something like this:

    ...
    hostDirectives:[
    {
    directive:CdkDrag
    }
    ]
    ...


    Dragging works fine but when I want to add cdkDragHandle in template:

    <div class="handle" cdkDragHandle></div>


    nothing changes - still whole component works as handle. In cdkDrag reference this handle is visible but not working:

    value: Array(1)
    0: _CdkDragHandle
    element: _ElementRef {nativeElement: div.cdk-drag-handle.handle}


    What am I doing wrong?

    Continue reading...

Compartilhe esta Página