![](/img/trans.png)
[英]Drag and drop angular-material2 chips with ng2-dragula library
[英]Drag and drop by ng2-Dragula library
移動后,我需要找出一個新的項目位置。
<div *ngFor="let group of groups; let index = index"
[dragulaItem]="group">
group.name
</div>
dragulaService.drop
.subscribe((dragulaBag) => {
console.dir(dragulaBag[1].dragulaItem);
});
返回具有舊位置的項目
拖動后如何獲取項目及其新位置?
是我的問題的答案
const groupId:數字= dragulaBag [2] .dragulaItem.id; const newPosition:number = this.groups.indexOf(dragulaBag [4] .dragulaItem)+ 1;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.