I\'m trying to recreate the Draggable + Sortable functionality from jQuery and can\'t get the dropped element to go into my array of objects.
I want t
You should be able to do every thing you need in your link function.
myapp.directive("menuDrag", function () {
return{
restrict: "A",
link: function (scope, element, attrs) {
var item = $(".draggable").draggable(
{
snap: true,
revert: false,
// scope:".dropable"
//scope: "tasks"
}
)
var target = $(".dropable").droppable({
greedy: true,
hoverClass: "warning",
accept: ".draggable"
})
item.on("drag", function (evt) {
item.css = ('background-color', 'red');
//evt.stopPropagation();
//evt.preventDefault();
})
target.on("over", function (evt) {
target.css('background-color', 'blue')
return false;
});
target.on("out", function (evt) {
dropBox.css('background_color', 'red');
return false;
});
target.on("drop", function (evt) {
alert("Droped");
return false;
});
//dragEnterLeave(evt);
}
}
})