Not able to display data in tree format using nested ng-repeat in AngularJS -
i have written html display data in tree format, not working expected. issue here.
i know can use custom directive that, want show in basic format. writing directive tricky.
<div data-ng-cloak data-ng-show="rootnode.children.totalavailable > 0"> <table border=1> <tr> <th>tree form</th> </tr> <tr data-ng-repeat="parent in rootnode.children.items"> <tr> <td> {{parent.displayname}} </td> </tr> <tr data-ng-repeat="firstchild in parent.children.items"> <tr> <td> {{firstchild.displayname}} </td> </tr> <tr data-ng-repeat="secondchild in firstchild.children.items"> <tr> <td> {{secondchild.displayname}} </td> </tr> </tr> </tr> </tr> </table> </div>
tree structure want display follows
parent 1 child 1.0 secondchild 1.0.1 secondchild 1.0.2 secondchild 1.0.3 child 1.1 secondchild 1.1.1 secondchild 1.1.2 secondchild 1.1.3 parent 2 child 2.0 secondchild 2.0.1 secondchild 2.0.2 secondchild 2.0.3 child 2.1 secondchild 2.1.1 secondchild 2.1.2 secondchild 2.1.3
thanks in advance.
maybe silly suggestion why don't use css text-indent
depending on child level? whole idea of tr
in tr
seems overcomplicated , poorly maintainable
Comments
Post a Comment