bevacqua / angularjs-dragula

:ok_hand: Drag and drop so simple it hurts
https://bevacqua.github.io/angularjs-dragula
MIT License
509 stars 110 forks source link

Using angularjs-dragula with components $onInit, initialise dragula through code. #105

Closed Mathem8tic closed 7 years ago

Mathem8tic commented 7 years ago

Im trying to dome something along these lines, but can never get the dragulaService.options to be recognised:

ctrl.$onInit = function() {

    menusService.menus().then(function(result){
        $scope.menus = result;
        angular.forEach($scope.menus.list, function(menu, key) {
            dragulaService.options($scope, menu.menu_name, {
                moves: function (el, container, handle) {
                    return handle.className === 'handle';
                }
            });
        });
    });
};

I seems that using the directive may not be the right approach for this? The directive seems to create bags '-1', '-2',...etc before the $onInit is called.

I am only semi comfortable with my ability to utilise the package correctly so any help would be appreciated.

dylanspurgin commented 6 years ago

@Mathem8tic If you found a solution to this issue, would you please post it here?