Make ngDialog draggable AngularJs jQueryUI

1k views Asked by At

I am wanting to make ngDialog draggable, using jQueryUI, or just Angular (preferred).

Here is an example of the modal becoming draggable using jQueryUI: JSFiddle (Modal)

$(".modal").draggable({
    handle: ".modal-header"
});

I tried to replicate it with ngDialog, but was not able to do so.. JSFiddle (ngDialog)

$(".ngdialog ").draggable({
  handle: ".ngdialog-content"
});

// $(".ngdialog ").draggable();

Here is demo of a div being draggable using a directive: JSFiddle (Directive), taken from this SO Question.

app.directive('dragMe', function() {
    return {
        restrict: 'A',
        link: function(scope, elem, attr, ctrl) {
            elem.draggable();
        }
    };
});
1

There are 1 answers

0
Slava On

put inside controller initialization:

$scope.$on('ngDialog.opened', function (e, $dialog) {
  $(".ngdialog").draggable({
    handle: ".ngdialog-content"
  });
});