
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
Module to use tree.js in your AngularJS applications.
It is available with bower:
bower install ng-tree
Then add the retrieved files to your HTML layout:
<script type="text/javascript" src="/path/to/bower_components/tree.js/tree.min.js"></script>
<script type="text/javascript" src="/path/to/bower_components/ng-tree/ng-tree.min.js"></script>
You can also use it with RequireJS as an AMD module.
Then add ngTree as dependency for your AngularJS application:
var app = angular.module('YOUR_APP', ['ngTree']);
To build a tree the module provides a service $treeFactory. Just call it to build a tree from raw data:
var tree = $treeFactory({
children: [
{
name: 'dupuis',
children: [
{
name: 'prunelle',
children: [
{
name: 'lebrac',
job: 'designer'
},
{
name: 'lagaffe',
firstname: 'gaston',
job: 'sleeper'
},
]
}
]
}
]
});
The tree is a hookable tree already configured to use $q as promises library.
$treeFactory get tree.js from window.Tree if you include it in others ways (with RequireJS for example), you can use anywhere $treeFactory.factory(YOUR TREE.JS) to configure it.
See tree.js for detailed documentation. The generated trees by $treeFactory work the same way with some improvements:
tree.registerListener(tree.HOOK_PRE_APPEND, function(next, newNode) {
// This is the classic way, it still works!
});
// You can also do:
tree.registerListener(tree.HOOK_PRE_APPEND, ['myService', function(myService) {
return function(next, newNode) {
// This is still our listener but you can now deal with `myService`
};
}]);
collapsed attribute and a toggle method which inverts attributes:tree.attr('collapsed'); // true
tree.toggle('collapsed');
tree.attr('collapsed'); // false
To display the tree you have to use the tree-view directive:
<tree-view tree="YOUR_TREE"></tree-view>
When a click is triggered on a tree or a sub-tree, the default behaviour is to toggle the collapsed attribute on it. You can add your own click handler by adding the attribute tree-click:
<tree-view tree="YOUR_TREE" tree-click="yourHandler(tree)"></tree-view>
You can pass to your handler two existing arguments:
$event: the click eventtree: the tree on which the click was triggeredThe handler can return both a classic value (or nothing) and a promise. If it returns a promise, the toggle action will occur only if the promise is resolved.
You can have a full access to the templates used by tree-view and tree-child-view in order to edit them with the service $treeTemplateFactory:
$treeTemplateFactory.tree() // returns tree-view template
$treeTemplateFactory.tree(NEW_TEMPLATE) // edit tree-view template
$treeTemplateFactory.treeChild() // returns tree-child-view template
$treeTemplateFactory.treeChild(NEW_TEMPLATE) // edit tree-child-view template
tree-view will represent the ul element and tree-child-view the li element.
To rebuild the minified JavaScript you must run: make build.
Install dependencies and run the unit tests:
make install
make test-spec
All contributions are welcome and must pass the tests. If you add a new feature, please write tests for it.
This application is available under the MIT License, courtesy of marmelab.
FAQs
Module to use tree.js into your AngularJS applications
The npm package ng-tree receives a total of 35 weekly downloads. As such, ng-tree popularity was classified as not popular.
We found that ng-tree demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.