7

i am trying to add the drag-drop feature in my Angular 6 application where i am trying to use angular material this is the overview link which i want to use. I followed the getting started instruction's but i am not able to use the "@angular/cdk/drag-drop" i tried installing the bellow package

npm install --save @angular/material @angular/cdk @angular/animations

and

npm install --save @angular/cdk

but the bellow folder is still missing enter image description here

import {DragDropModule} from '@angular/cdk/drag-drop';

the drag-drop is not available in my project even after following the steps. can anyone help me with that

Jasmin Raval
  • 184
  • 1
  • 5
  • 15
  • It looks like all you need to do is close and reopen your IDE. If you're using VS Code, press the F1 key, then choose *Developer: Reload Window* from the dropdown. – R. Richards Mar 23 '19 at 10:35
  • hi @R.Richards thank you very much for the response but I am still facing the same problem after trying your solution – Jasmin Raval Mar 23 '19 at 10:40

3 Answers3

6

@angular/cdk/drag-drop exists only from version 7.0.0 of @angular/cdk. It seems you have to update angular and cdk to use drag-drop

Andrei
  • 10,117
  • 13
  • 21
  • thank you @Andrei for your solution but is there any other solution where I do not requires to update the Angular project – Jasmin Raval Mar 23 '19 at 11:20
  • 1
    If you want the exact @angular/cdk/drag-drop library then no, you have to upgrage. If no then you can use some other drag-and-drop library. the most popular for angular is [ng2-dragula](https://github.com/valor-software/ng2-dragula) – Andrei Mar 23 '19 at 11:22
1

I had the same error. Try: ng add @angular/material

0

Try this npm install @angular/cdk

user3302090
  • 177
  • 3
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/34539349) – Whit Waldo Jun 16 '23 at 20:05