0

I'm trying to find the best way to do something like JQuery sortable in Angular JS. I know there is sortbale directive in angular-ui, but what I need is to be able to drag and drop items in multiple columns.

In JQuery this is done by $(el).sortable({connectWith: '.column'});

Is there a way to do that in Angular? As Angular newbie I don't want to play with JQuery sortable, as I know it doesn't fit Angular model well (DOM is manipulated in jQuery, outside Angular context, so it's tricky to have it synchronized).

2 Answers 2

1

Are you just looking for the orderBy filter?

Sign up to request clarification or add additional context in comments.

Comments

0

You need to include:

  1. JQuery
  2. JQueryUI
  3. Angular

You need to create a directive:

directives.directive('sortable', function() {
    return {
        restrict: 'A',
        link: function(scope, element) {
            element.sortable({
                connectWith: ".column",
                start: function(event, ui) {},
                stop: function(event, ui) {},
                receive: function(event, ui) {}
            });
        }
    };
});

You need to apply the directive:

<div class="column" sortable></div>

In the example above the sortable can connect with the class column.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.