【发布时间】:2015-09-14 05:38:30
【问题描述】:
我使用ng-sortable 来重新排序列表元素。 我打算应用 ng-sortable 的列表是:
列表 B : [object Object],[object Object],[object Object]
以下是我的代码:
HTML --
<div data-as-sortable-item-handle>
<!-- <div class="list-group-item"> -->
{{$index + 1}}{{user.Name}} <input ng-click="ctrl.selectB(user.id)" name="ctrl.selectedB[]" value="{{user.id}}" ng-checked="ctrl.selectedB.indexOf(user.id) > -1"
type="checkbox" class="pull-right">
<!-- </div> -->
</div>
</li>
</ul>
控制器 --
$scope.dragControlListeners = {
accept: function (sourceItemHandleScope, destSortableScope)
{return sourceItemHandleScope.itemScope.sortableScope.$id === destSortableScope.$id;},
itemMoved: function (event) {
//Do what you want },
},
orderChanged: function(event) {
//Do what you want},
}
};
但我得到了错误:
TypeError: 无法读取未定义的属性“0”
TypeError:无法读取未定义的属性“1”
当我尝试拖动元素时,所有元素都被视为一个单独的单元并被拖动,实际上我希望每个 li 元素单独行动并且可以拖动。
出现错误 -
未捕获的类型错误:无法读取未定义的属性“拼接”
【问题讨论】:
标签: angularjs ng-sortable