【问题标题】:AngularJS Drag and DropAngularJS 拖放
【发布时间】:2015-09-16 07:23:38
【问题描述】:

如果我有一个像下面这样的 JSON ..

$scope.pools = [    {id: 1, poolName : 'Pool1', env : 'Env1', executionMode: 'Both',
        modelets: [{id: 'm1', name : 'MM1', status : 'active', capacity : '1 GB'},
                   {id: 'm2', name : 'MM2', status : 'active', capacity : '1 GB'},
                   {id: 'm3', name : 'MM3', status : 'active', capacity : '1 GB'}]},
    {id: 2, poolName : 'Pool2', env : 'Env2', executionMode: 'Both',
        modelets: [{id: 'm4', name : 'MR1', status : 'active', capacity : '1 GB'},
                   {id: 'm5', name : 'MR2', status : 'active', capacity : '1 GB'}]
    }
];

我必须将模型从一个池拖放到另一个池。例如,如果我将 m3 从 pool1 拖放到 pool2 的 modelets 中,则 m3 应该从 pool1.modelets 中删除,并且应该添加到 pool2.modelets 中,反之亦然。

注意:我正在尝试使用http://codef0rmer.github.io/angular-dragdrop/#/

请给我有效的解决方案。不胜感激。

【问题讨论】:

标签: angularjs


【解决方案1】:

最后,我得到了在这种情况下运行良好的东西...... 我们需要对可拖动元素进行以下更改。

<div class="btn btn-primary" data-drag="true" data-jqyoui-options="{revert: 'invalid'}" ng-model="pool.modelets" jqyoui-draggable="{index: {{$index}},animate:true}" ng-hide="!modelet.name">{{modelet.name}}</div>

updated fiddler 工作正常。

【讨论】:

    猜你喜欢
    • 2013-06-28
    • 2014-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多