We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ng-drag-drop Drop not working. dropping an item does nothing
npm install ng-drag-drop --save
Import NgDragDropModule import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { DemoComponent } from "./components/demo-component"; import { NgDragDropModule } from 'ng-drag-drop'; @NgModule({ imports: [ BrowserModule, NgDragDropModule.forRoot() ], declarations: [DemoComponent], bootstrap: [DemoComponent] }) export class AppModule {}
ts code
import {Component} from '@angular/core'; @Component({ selector: 'app', template: ` <div class="row"> <div class="col-sm-3"> <ul class="list-group"> <li draggable *ngFor="let item of items" [dragData]="item" class="list-group-item">{{item.name}}</li> </ul> </div> <div class="col-sm-3"> <div class="panel panel-default" droppable (onDrop)="onItemDrop($event)"> <div class="panel-heading">Drop Items here</div> <div class="panel-body"> <li *ngFor="let item of droppedItems" class="list-group-item">{{item.name}}</li> </div> </div> </div> </div> ` }) export class AppComponent { items = [ {name: "Apple", type: "fruit"}, {name: "Carrot", type: "vegetable"}, {name: "Orange", type: "fruit"}]; onItemDrop(e: any) { // Get the dropped data here this.droppedItems.push(e.dragData); } constructor() { } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ng-drag-drop
Drop not working. dropping an item does nothing
npm install ng-drag-drop --save
ts code
The text was updated successfully, but these errors were encountered: