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.

feat(drag-drop): cdkConnectedTo finds all drop lists with the same ID, instead of only one

See original GitHub issue

Feature Description

CdkDropList has id and cdkConnectedTo input properties to allow specifying an id or array of ids for which the drop lists should be connected.

The id input property “needs” to be unique, or better put is “assumed” to be unique - meaning when searching through drop lists to connect to by id, only the first match is returned.

Can the “need” for unique ids be removed and change the connected drop list logic to return all drop lists with a matching id?

From the user’s perspective:

  • If I want a drop list to inherently be standalone, provide a unique id.
  • If I want a drop list to inherently be connected to others, provide a shared id.

Use Case

Connecting drop lists created dynamically, possibly defined in separate template files and with arbitrary DOM relation, without the overhead of having to maintain a separate list of all drop lists that should be connected, and making sure this list is properly updated and propagated to each drop list via change detection.

Instead a statically defined (or could be dynamic) id for the id and cdkConnectedTo inputs will automatically connect all the drop lists without any further coordination from the user.

Similar to what @sroettering mentioned here, but I don’t think a new input property is necessary.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Achilles1515commented, Jul 22, 2020

I can sort of see the use case here, but we already called the input id which corresponds to the native id and is required by the browser to be unique.

Ah, right. Perhaps a new input property then for a group id.

0reactions
angular-robot[bot]commented, Mar 15, 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

Drag and Drop with lists in different components - Angular cdk
You may use properties id and cdkDropListConnectedTo to link both lists.
Read more >
Drag and Drop | Angular Material
When outside of a cdkDropList element, draggable elements can be freely moved around the page. You can add cdkDropList elements to constrain where...
Read more >
Getting to Know the Angular CDK Drag and Drop Feature
In this article, we'll learn how to use the drag and drop feature. ... If the user is dragging an element within the...
Read more >
Exploring Drag and Drop with the new Angular Material CDK
We'll use the *ngFor directive to create the list elements inside a cdkDrop container.. <div cdkDrop>.
Read more >
Angular CDK: Sorting Items using Drag & Drop - This Dot Labs
There is no doubt that we are living in an era where the interactivity of your web application is a very important part...
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