我是angularJS的初学者。我试图在容器中各个div的拖放完成后获得位置变化。 我在他们的网站上尝试了一些代码片段,但无法找到解决方案。
以下是我使用的代码段:
使用的模板:
<div class='container' dragula='"first-bag"'>
<div>You can move these elements between these two containers</div>
<div>Moving them anywhere else isn't quite possible</div>
<div>There's also the possibility of moving elements around in the same container, changing their position</div>
</div>
在我的控制器中:
$scope.$on('first-bag.drag', function (e, el) {
el.removeClass('ex-moved');
console.log(e);
console.log(el);
});
$scope.$on('first-bag.drop', function (e, el) {
el.addClass('ex-moved');
console.log(e);
console.log(el.id);
});
$scope.$on('first-bag.over', function (e, el, container) {
container.addClass('ex-over');
console.log(e);
console.log(el);
});
$scope.$on('first-bag.out', function (e, el, container) {
container.removeClass('ex-over');
console.log(e);
console.log(el);
});
如果我走在正确的道路上,或者我在任何地方出错,有人可以指导我。