0
votes

I am new to angularjs and need to display tree view structure. I came to know angular-ivh-tree view has lot of configurable options with checkbox support and hence tried in my application. It's displaying the treeview with checkboxes. But it's not displaying the slected node information when i selected some node in treeview.

Please guide me to display the selected node label, value and children.

Below code used in controller:

 $scope.bag = [{
            label: 'Glasses',
            value: 'glasses',
            children: [{
                label: 'Top Hat',
                value: 'top_hat'
            }, {
                label: 'Curly Mustache',
                value: 'mustachio'
            }]
        }];
};

below code used in html view:

 <div data-ivh-treeview="bag"
data-ivh-treeview-use-checkboxes="true"
         data-ivh-treeview-filter="bagSearch"    
data-ivh-treeview-selected-attribute="isSelected"></div>

    <ul>
            <li data-ng-repeat="x in bag">
                {{ x.label + ', ' + x.value }}
             </li>
    </ul>

used angular ivh related link:

https://github.com/iVantage/angular-ivh-treeview

But children and selected node information not displaying. Please guide me.

1

1 Answers

1
votes

In your bag you have a key called "children".

The default key value for children objects in the ivh-treeview is "items":

ivh-treeview-children-attribute="'items'"

Look at the Options section:

IVH Treeview is pretty configurable. By default it expects your elements to have label and children properties for node display text and child nodes respectively (...)