Ngx chips:拖动后获取当前订单
Ngx chips : Get current order after dragging
我启用了 dragzone 属性,添加的芯片现在可以拖动了。
那么拖动之后,我们如何获取当前筹码的顺序?
一如既往地在 Angular 中,您可以使用 two way binding. In fact you can get the order from the binded ngmodel 值。
在输入中拖放的示例:
<div>
<h3>Drag and drop</h3>
<tag-input [(ngModel)]="dragAndDropExample"
[modelAsStrings]="true"
[dragZone]="'zone1'"
[editable]="true">
</tag-input>
</div>
在输入之间拖放的示例代码:
<div>
<h3>Drag and drop (as string) can be moved to another tag-input (to the next)</h3>
<tag-input [(ngModel)]="dragAndDropStrings"
[modelAsStrings]="true"
[dragZone]="'zone1'"
[editable]="true">
</tag-input>
</div>
<div>
<h3>Drag and drop (as object) can be moved to another tag-input (to the previous)</h3>
<tag-input [(ngModel)]="dragAndDropObjects"
[dragZone]="'zone1'"
[editable]="true">
</tag-input>
</div>
我启用了 dragzone 属性,添加的芯片现在可以拖动了。 那么拖动之后,我们如何获取当前筹码的顺序?
一如既往地在 Angular 中,您可以使用 two way binding. In fact you can get the order from the binded ngmodel 值。
在输入中拖放的示例:
<div>
<h3>Drag and drop</h3>
<tag-input [(ngModel)]="dragAndDropExample"
[modelAsStrings]="true"
[dragZone]="'zone1'"
[editable]="true">
</tag-input>
</div>
在输入之间拖放的示例代码:
<div>
<h3>Drag and drop (as string) can be moved to another tag-input (to the next)</h3>
<tag-input [(ngModel)]="dragAndDropStrings"
[modelAsStrings]="true"
[dragZone]="'zone1'"
[editable]="true">
</tag-input>
</div>
<div>
<h3>Drag and drop (as object) can be moved to another tag-input (to the previous)</h3>
<tag-input [(ngModel)]="dragAndDropObjects"
[dragZone]="'zone1'"
[editable]="true">
</tag-input>
</div>