Replace draggable function in angular 2
问题 I am trying to convert an angular directive written in angular 1.* to angular 2. Here is the original directive code: this.directiveModule.directive('draggable', function(CONFIG) { return { restrict: 'A', link: function(scope, elem, attrs) { var setInitPosition; setInitPosition = function() { return elem.css({ top: scope.position.top + 'px', left: scope.position.left + 'px' }); }; elem.draggable({ containment: "parent", stop: function(ev, ui) { return scope.position = { top: ui.position.top,