wix-incubator / angular-tree-control

Angular JS Tree
http://wix.github.io/angular-tree-control
MIT License
708 stars 277 forks source link

A bug on line 68 #234

Open lizhongit opened 8 years ago

lizhongit commented 8 years ago

Original code:

     function defaultIsLeaf(node) {
            return !node[$scope.options.nodeChildren] || node[$scope.options.nodeChildren].length === 0;
      }

Sometimes, My Dir will be empty, So except like this:

     function defaultIsLeaf(node) {
          return !node[$scope.options.nodeChildren];
      }
yoavaa commented 8 years ago

I am not sure I understand - why is the code above wrong?

lizhongit commented 7 years ago

@yoavaa If my DIR empty but icon are leaf, May be the DIR no any children leaf, but it is real DIR, I can open it

lizhongit commented 7 years ago

The new code:

    function defaultIsLeaf(node, $scope) {
        // return !node[$scope.options.nodeChildren] || node[$scope.options.nodeChildren].length === 0;
        return !Array.isArray(node[$scope.options.nodeChildren]);
    }