Mohsen Mohebbi
Mohsen Mohebbi

Reputation: 77

angular cdk drag & drop Directly by click event Instead of dragging

angular cdk drag & drop : how drag item to done List Directly by click event Instead of dragging For example on the 'jotform' site , when we click on each item in Left section Items, it performs operations automatically and drag it to main list

Upvotes: 0

Views: 1657

Answers (1)

Nimer Awad
Nimer Awad

Reputation: 4199

That's should be an easy case, if I got it well; you wanna move an Item from a list to another when the user clicks on a button, right?

moveItem(previousList, currentList, previousIndex) {
    // let assume that the user will move it as last element
    let currentIndex = this.currentList.length;
    transferArrayItem(previousList,
        currentList,
        previousIndex,
        currentIndex);
}

Upvotes: 2

Related Questions