angular-tree-control
angular-tree-control copied to clipboard
A bug on line 68
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];
}
I am not sure I understand - why is the code above wrong?
@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
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]);
}