Angular js Sortable Drag and Drop

时间:2017-07-05 17:41:09

标签: angularjs draggable jquery-ui-sortable angular-dragdrop

陷入我有列表列表的问题,我想通过拖放我的模型来重新排序列表列表

  {
  "selected": null,
  "lists": {
    "A": [
      {
        "data": "code"
      },
      {
        "data": "code enable"
      },
      {
        "data": "code disable"
      }
    ],
    "B": [
      {
        "data": "code"
      },
      {
        "data": "code enable"
      },
      {
        "data": "code disable"
      }
    ],
    "C": [
     {
        "data": "code"
      },
      {
        "data": "code decode"
      },
      {
        "data": "code decode"
      }
    ]
  }
}

现在我想重新订购这个模型,如果我将列表C 拖到列表A 它应该替换div新模型将< / p>

   {
  "selected": null,
  "lists": {
    "C": [
      {
        "data": "code"
      },
      {
        "data": "code decode"
      },
      {
        "data": "code decode"
      }
    ],
    "B": [
      {
        "data": "code"
      },
      {
        "data": "code enable"
      },
      {
        "data": "code disable"
      }
    ],
    "A": [
      {
        "data": "code"
      },
      {
        "data": "code enable"
      },
      {
        "data": "code disable"
      }
    ],
  }
}

app.html

          <div ng-repeat="list in models.lists" class="col-md-6">
            <div class="panel panel-info" ng-repeat="data in lists">
                <div class="panel-heading">
                    <h3 class="panel-title">List {{data.data}}</h3>
                </div>
            </div>
        </div>

app.js

 $scope.models = {
    selected: null,
    lists: {"A": [], "B": [],"C":[]
};

// Generate initial model

0 个答案:

没有答案