 
 KanbanUserstoryDirective = ($rootscope) ->
     link = ($scope, $el, $attrs, $model) ->
+        $el.disableSelection()
+
         $el.find(".icon-edit").on "click", (event) ->
             if $el.find(".icon-edit").hasClass("noclick")
                 return
+
             $scope.$apply ->
                 $rootscope.$broadcast("usform:edit", $model.$modelValue)
         if $scope.us.is_blocked
             $el.addClass("blocked")
-        $el.disableSelection()
+
+        $scope.$on "$destroy", ->
+            $el.off()
 
     return {
         templateUrl: "/partials/views/components/kanban-task.html"
         link: link
         require: "ngModel"
     }
-
 
 module.directive("tgKanbanUserstory", ["$rootScope", KanbanUserstoryDirective])
 

                    $ctrl = $el.controller()
                    $ctrl.changeUsAssignedTo(us)

    return {link: link, require:"ngModel"}


module.directive("tgKanbanUserAvatar", ["$log", KanbanUserDirective])

        $scope.$on "kanban:us:move", redrawWipLimit
        $scope.$on "usform:new:success", redrawWipLimit
        $scope.$on "usform:bulk:success", redrawWipLimit

        $scope.$on "$destroy", ->
            $el.off()

    return {link: link}

