标签: ng-sortable

TypeError:无法读取未定义的属性"0" - ng-Sortable(AngularJs)

我使用ng-sortable来重新排序列表元素的功能.我打算应用ng-sortable的列表是:

列表B:[对象对象],[对象对象],[对象对象]

以下是我的代码:

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>
Run Code Online (Sandbox Code Playgroud)

控制器 -

$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},
                        }
                                        };
Run Code Online (Sandbox Code Playgroud)

但我收到错误:

TypeError:无法读取未定义的属性"0"

TypeError:无法读取未定义的属性"1"

当我尝试拖动元素时,所有元素都被视为一个单元并被拖动,在契约中我希望每个元素单独行动并且可以拖动.

得到错误 -

未捕获的TypeError:无法读取undefined的属性'splice'

angularjs ng-sortable

2
推荐指数
1
解决办法
2790
查看次数

标签 统计

angularjs ×1

ng-sortable ×1