我创建了柱塞中的ng可排序示例,但它不起作用。
这里是JavaScript:
angular.module('sortableExample', [])
.controller('PresidentsCtrl', ['$scope', function($scope) {
$scope.presidents = [
'George Washington',
'Abraham Lincoln',
'William Jefferson Clinton'
];
$scope.dragControlListeners = {
accept: function(sourceItemHandleScope, destSortableScope) { return true },
itemMoved: function(event) {},
orderChanged: function(event) {}
};
}]);以及HTML:
<!DOCTYPE html>
<html ng-app="sortableExample">
<head>
<script data-require="angular.js@1.5.6" data-semver="1.5.6" src="https://code.angularjs.org/1.5.6/angular.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="https://raw.githubusercontent.com/a5hik/ng-sortable/master/dist/ng-sortable.js"></scr</script>
<link rel="stylesheet" href="https://raw.githubusercontent.com/a5hik/ng-sortable/master/dist/ng-sortable.css">
<script src="script.js"></script>
</head>
<body ng-controller="PresidentsCtrl">
<ul data-as-sortable="dragControlListeners" data-ng-model="presidents">
<li data-ng-repeat="president in presidents" data-as-sortable-item>
<div data-as-sortable-item-handle>{{ president }}</div>
</li>
</ul>
</body>
</html>正确的东西会出现,但它并不像它应该的那样具有交互性。知道为什么吗?
发布于 2016-06-10 16:26:34
你不应该包括到github源的链接-),因为没有cdn的ng排序-只是复制到柱塞。
此外,您还忘记添加ng-app的依赖项。
angular.module('sortableExample', ['as.sortable'])http://plnkr.co/edit/gRRzaVfwIycdzfApmebB?p=preview
https://stackoverflow.com/questions/37751780
复制相似问题