Angular-Tree-View

A dynamic tree view directive for Angular 1.5.*

Tree View API

branch-name
String Optional

If set, specifies the property that will contain additional children.

Since: Default Value:

Example

<ea-tree-view ... branch-name="kids" ...></ea-tree-view>

angular.module('demo', ['ea.treeview']).controller('mainController', function($scope) {
    $scope.model.items = [
        {
            display: 'What to Show', kids: [
                {
                    display: 'A child display value', kids: [
                        {display: 'A grandchild display value'}
                    ]
                }
            ]
        }
    ];
});
callback
Function Optional

If set, specifies the name of the function on the root controller to invoke when an item is clicked.
The callback function accepts the item that was clicked as a parameter.

Since: Default Value:

Example

<ea-tree-view ... callback="go" ...></ea-tree-view>
angular.module('demo', ['ea.treeview']).controller('mainController', function($scope) {
    $scope.go = function(item) {
        console.log(item);
    }
});
dataset-id
String Number Optional

Only necessary when multiple Tree Views are used in a single module.

If set, specifies the id to use to allow each Tree View within a single module to identify its own data without interfering with other Tree View controls

Since: Default Value:

Example

<ea-tree-view ... dataset-id="$id" ...></ea-tree-view>
is-root
Boolean Optional

Only necessary when using a single Tree View with a router (such as ui-router).

If set, specifies that the Tree View should be the root, which allows the router to properly expand the parents of a route and "select" the matching item based on the route.

Since: Default Value:

Example

<ea-tree-view ... is-root="false" ...></ea-tree-view>
items
Array Required

The array containing the items to build the Tree View

Since:

Example

<ea-tree-view ... items="friggafromptons" ...></ea-tree-view>
angular.module('demo', ['ea.treeview']).controller('mainController', function($scope) {
    $scope.model.friggafromptons = [
        {
            display: 'What to Show', kids: [
                {
                    display: 'A child display value', kids: [
                        {display: 'A grandchild display value'}
                    ]
                }
            ]
        }
    ];
});
item-template-url
StringOptional

The URL of the template to use in the event you've created your own.

Note: Only one template may be specified for all Tree Views in the module. There is currently no way to specify a different template for each Tree View

Since:

Example

<ea-tree-view ... item-template-url="/templates/customItemTemplate.html" ...></ea-tree-view>