我使用这个方向:http://marceljuenemann.github.io/angular-drag-and-drop-lists/demo/#/types
我有移动卡的问题,当我移动卡更高是好的,如果卡提供较少的问题开始.
我做了这个功能:
if ($scope.movingItem.indeksList == index) {
console.log('qrwa')
$scope.lists[$scope.movingItem.indeksList].cards.splice($scope.movingItem.IndexCard +1, 1);
$scope.lists[index].cards = external[index].cards;
} else {
console.log('qrwa2')
$scope.lists[$scope.movingItem.indeksList].cards.splice($scope.movingItem.IndexCard, 1);
$scope.lists[index].cards = external[index].cards;
}
Run Code Online (Sandbox Code Playgroud)
如果我在同一个列表中进行移动并且我将卡移到更高的位置就可以了,那么必须执行:
$scope.lists[$scope.movingItem.indeksList].cards.splice($scope.movingItem.IndexCard +1, 1);
Run Code Online (Sandbox Code Playgroud)
从上到下必须执行:
$scope.lists[$scope.movingItem.indeksList].cards.splice($scope.movingItem.IndexCard, 1);
Run Code Online (Sandbox Code Playgroud)
这里有问题我无法获得$ index在哪个地方我放卡如果我移动卡降低使这个表演,如果更高使这个表演...
这是整个项目:https: //plnkr.co/edit/BVF0KxPrWiCeGDXVpQDV?p = preview
AngularJS不对ng-repeat进行排序.我做到了,
<div ng-repeat="list in lists">
<div style="float: left; margin-left: 5px;">
<div id="tasks" >
<h3>{{ list.name }}</h3>
<ul>
<li ng-repeat="card in cards | orderBy:'card.position'" ng-if="list._id == card.list">{{ card.position }}<button ng-click="take(card.position)">HERE</button>{{ $index }}</li>
</ul>
<form ng-submit="addTask(list._id, $index, newTask)">
<input type="text" ng-model="newTask" placeholder="add a new task" required />
</form>
</div>
</div>
</div>
console.log($scope.cards[0]);
Run Code Online (Sandbox Code Playgroud)
以上代码的输出是:
Object { _id: "59bc0936c84be51d70f786e7", name: "first", list: "59bbdeae1ebcd215a4b7af62", position: 7200, __v: 0, created: "2017-09-15T17:09:10.813Z", updated: "2017-09-15T17:09:10.813Z" }
Run Code Online (Sandbox Code Playgroud)
我哪里可以犯错?