question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[CdkDrag]: Allow out of scope binding with drop container

See original GitHub issue

Bug, feature request, or proposal: proposal

What is the expected behavior?

CdkDrag accepts CdkDropListContainer as an @Input (in addition to the current injection logic)

What is the current behavior?

CdkDrag accepts CdkDropListContainer from DI (optional) or through direct assignment.

What is the use-case or motivation for changing an existing behavior?

When CdkDropListContainer comes from DI it requires the drop container to be a direct parent of the drag element.

When working with dynamic content (table, tree, select, or any “portal like” components) it is sometimes not possible to have the container and the drag element in a parent/descendant relationship.

For example: In a CdkTable dragging a header cell left/right having the header row as the drop container. The row and cell are not defined as parent/descendant in the template and the view creators will not pass the proper injectables in such case.

The current implementation does not require a drop container, it’s optional. So adding an @Input is quite simple. The init only happen when actual dragging starts so it shouldn’t be an issue.

The CdkDropList will require some modifications because it uses a template query to get all of the child drag items it manages. This is also doable… Maybe by having a flag that defines the work mode or another directive that does not use a template query.

When a drag item is assigned a drop container it will notify the container so it can store a ref to it… doing the same when the drag is destroyed or disconnected from the parent drop container.

Thanks!

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:7
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
dddeeennncommented, Dec 12, 2018

@NitsanBaleli I create demo.

0reactions
angular-robot[bot]commented, Feb 22, 2022

Thank you for submitting your feature request! Looks like during the polling process it didn’t collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular’s scope, we’d encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Material Drag Drop within Component Module
this issue is still open, so allowing out of scope binding may still be in the works. https://github.com/angular/material2/issues/14099. CdkDrag ...
Read more >
Drag and Drop | Angular Material
You can now add the cdkDrag directive to elements to make them draggable. When outside of a cdkDropList element, draggable elements can be...
Read more >
Angular Drag and Drop - Javatpoint
Now you can add the cdkDrag directive to make elements draggable. When outside a cdkDropList element, draggable elements can be moved freely around...
Read more >
New Angular Drag And Drop Feature - ngDragDrop - C# Corner
We should also add the property cdkDrag in our Draggable item, which is nothing but a movie. Now, let us create another container...
Read more >
Angular Material Drag Drop within Component Module ...
this issue is still open, so allowing out of scope binding may still be in the works. https://github.com/angular/material2/issues/14099. CdkDrag accepts a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found