我使用this例如
我做的完全一樣的,但我收到以下錯誤
angular.js:14525 Error: [$injector:unpr] Unknown provider: $elementProvider <- $element <- DragulardndCtrl http://errors.angularjs.org/1.6.4/$injector/unpr?p0=%24elementProvider%20%3C-%20%24element%20%3C-%20DragulardndCtrl at angular.js:66 at angular.js:4789 at Object.getService [as get] (angular.js:4944) at angular.js:4794 at getService (angular.js:4944) at injectionArgs (angular.js:4969) at Object.instantiate (angular.js:5015) at $controller (angular.js:10881) at Object.link (angular-route.js:1214) at angular.js:1346 "<div ng-view="" class="ng-scope">"
我已經產生與自耕農angular.The代碼項目下面給出
Controller :
angular.module('dragdropApp')
.controller('DragulardndCtrl', ['$scope', '$element', 'dragularService', function TodoCtrl($scope, $element, dragularService) {
$scope.items1 = [{
content: 'Move me, but you can only drop me in one of these containers.'
}, {
content: 'If you try to drop me somewhere other than these containers, I\'ll just come back.'
}, {
content: 'Item 3'
}, {
content: 'Item 4'
}];
$scope.items2 = [{
content: 'Item 5'
}, {
content: 'Item 6'
}, {
content: 'Item 7'
}, {
content: 'Item 8'
}];
var containers = $element.children().children();
dragularService([containers[0],containers[1]],{
containersModel: [$scope.items1, $scope.items2]
});
}])
HTML:查看
<div class='tableRow'>
<div class='containerVertical'>
<div ng-repeat="item in items1">{{item.content}}</div>
</div>
<div class='containerVertical'>
<div ng-repeat="item in items2">{{item.content}}</div>
</div>
</div>
<div class="tableRow">
<div class="container">
<div>Items1:
<br/>{{items1 | json}}</div>
</div>
<div class="container">
<div>Items2:
<br/>{{items2 | json}}</div>
</div>
</div>
我從上述鏈接中使用完全相同的代碼。
在此先感謝
PLE ase顯示您的代碼片段,以便我們可以幫助您更新 – wickedchild
。我已經使用了示例代碼 – TheTechGuy
我認爲它需要Jquey,您忘記了包含 –