ezraroi / ngJsTree

Angular Directive for the famous JS Tree
http://ezraroi.github.io/ngJsTree/
MIT License
270 stars 101 forks source link

Custom directive for double click event on the tree elements #118

Open shiv12095 opened 7 years ago

shiv12095 commented 7 years ago

I am trying to implement double click functionality on the leaf node elements of the tree. I have created a custom directive like this.

var app = angular.module("app", []);
app.directive("jstreeLeaf", function jstreeLeafDirective(){
  var directive = {
    restrict: "C",
    link: function link(elem, attrs) {
      elem.bind("dblclick", function() {
        console.log("Double click event");
      });
    }
  return directive;
});

However this fails to register the double click events on the leaf nodes since the tree is created after angular compiles the html.

Is there a way to recompile the tree so that my custom directive can work on the nodes?

Alternatively, is there another way that I can use to implement double click functionality ?