Ngx芯片:拖动后获取当前订单

时间:2019-09-17 14:53:22

标签: angular typescript ngx-chips

我启用了dragzone属性,添加的筹码现在可以拖动。 那么拖动之后,我们如何获得当前的筹码顺序?

1 个答案:

答案 0 :(得分:2)

与往常一样,您可以使用two way binding。实际上,您可以从binded ngmodel值中获取订单。

code中查看示例demo page

在输入内部拖放的示例:

    <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>