0

Is there any way to connect cdkDrag element with ng-template where in that ng-template there is a cdkDragHandle?

I would like to drag element only by tag marked with cdkDragHandle.

Here is small stackblitz to show the issue: https://stackblitz.com/edit/angular-admshu?file=src/app/cdk-drag-drop-connected-sorting-group-example.html

  • 1
    The answer in the linked question sums it up pretty well - cdkDrag relies on initial structure, so if `cdkDragHandle` is not ancestor of `cdkDrag` it will not work. Your best bet is to have two templates - one for handle, other for contents, and wrap the template for handler in a div with `cdkDragHandle`. – TotallyNewb Jan 25 '23 at 08:27
  • @TotallyNewb I'm not sure if I follow :( Are you able to change my stackblitz a little and show it on example? I would be greateful. – michalgrzegorczyk-dev Jan 25 '23 at 10:04
  • 1
    Something like this: https://stackblitz.com/edit/angular-admshu-kxrutc – TotallyNewb Jan 25 '23 at 10:59

0 Answers0