New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cdkDrag does nothing when inside an *ngFor looping through a returned 2 dimensional array #15807
Comments
This is because calling Because of that, the draggable item is recreated on every CD cycle, which resets its position. This can be proven easily by making the component OnPush making the items draggable. So this is actually not a bug, but just incorrect usage. Generally you just shouldn't call functions from templates, but if you must, specifying a |
@Airblader's explanation is correct. Closing since this works as expected. |
Thanks for the detailed explanation, makes sense. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
What is the expected behavior?
cdkDrag works from inside an ngFor looping through an array with a nested array.
What is the current behavior?
Nothing happens. cdkDrag does not move or drag.
What are the steps to reproduce?
https://stackblitz.com/edit/angular-a4ftm7-oectv4?file=app%2Fcdk-drag-drop-connected-sorting-example.html
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
chrome browser, angular 7.1.0 and 7.2.0, material 7.1.0 and 7.3.7
Is there anything else we should know?
Happy to explain more if this isn't clear. Had me stumped for hours. :(
The text was updated successfully, but these errors were encountered: