1.0.0 • Published 4 years ago

lockes-sample-angular-drag-drop v1.0.0

Weekly downloads
4
License
-
Repository
-
Last release
4 years ago

AngularDragDrop

This project was generated with Angular CLI version 9.1.7.

it was created as a how to create a drag drop app

How to build me

  1. ng new angular-drag-drop
  2. cd angular-drag-drop/
  3. ng add @angular/material
  4. npm install @angular/cdk
  5. import CUSTOM_ELEMENTS_SCHEMA in app.module.ts
  6. add schemas: [CUSTOM_ELEMENTS_SCHEMA] to @NgModule
  7. set the following in the css {cdk-drag-preview,.cdk-drag-placeholder,.cdk-drag-animating}
  8. import { CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop' in app.component.ts
  9. create arrays in app.component.ts
  10. add onDropMethod()
  11. create two div with the cdkDropList markup, cdkDropListData='', cdkDropListConnectedTo="" and finaly (cdkDropListDropped)="onDrop($event)"
  12. inside each cdkDropList a div for each item in the array and a cdkDrag markup
  13. run ng serve --open=true

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.