Dragging from one component and dropping into another clears data for the second last object from array
nilamJadhavClarion opened this issue · 0 comments
nilamJadhavClarion commented
I am trying to drag element from one component to another component but there are 2 issues-
-
Item is getting copied but element is not getting displayed on UI -This issue is resolved
-
When I drag second last element it is removing last element from the list of first component - Still facing this issue
Below is code snippet-
component 1 HTML-
<div [sortablejs]="examList" [sortablejsOptions]="options1">
<div class="exam-card" *ngFor="let exam of examList">
{{exam.name}}
</div>
</div>
component 1 TS-
public options1: SortablejsOptions = {
group: 'shared',
sort: false,
handle: '.exam-card',
onRemove: () => {
console.log(this.examList);
}
};
public examList= [{name: 'abc'}, {name: 'def'}, {name: 'test'}];
component 2 HTML-
<div [sortablejs]="examList2" [sortablejsOptions]="options2">
<div class="exam-card" *ngFor="let exam of examList2">
{{exam.name}}
</div>
</div>
component 2 TS-
public options2: SortablejsOptions = {
group: 'shared',
sort: false,
handle: '.exam-card',
onAdd: () => {
console.log(this.examList2);
}
};
public examList2= [];