A dynamic tree view directive for Angular 1.5.*
If set, specifies the property that will contain additional children.
Since: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'}
]
}
]
}
];
});
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.
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);
}
});
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:Example
<ea-tree-view ... dataset-id="$id" ...></ea-tree-view>
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:Example
<ea-tree-view ... is-root="false" ...></ea-tree-view>
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'}
]
}
]
}
];
});
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>