Skip to content

Instantly share code, notes, and snippets.

@amcdnl
Created April 1, 2014 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amcdnl/9924482 to your computer and use it in GitHub Desktop.
Save amcdnl/9924482 to your computer and use it in GitHub Desktop.
define(['angular',
'jquery',
'jqueryUI',
'lib/jquery-ui-touch/jquery-ui-touch'], function(angular, $){
var module = angular.module('components.draggable', []);
module.constant('draggableConfig', {
helper: 'clone',
appendTo: 'body',
connectToSortable: ".sortable"
});
module.directive('draggable', function ($timeout, draggableConfig) {
return {
restrict: 'AE',
scope: {
ngModel: '=',
options: '='
},
link: function($scope, $element, $attributes) {
var options = angular.extend(draggableConfig, $scope.options);
$element.draggable(options);
}
};
});
return module;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment