A factory that creates a tree structure from an object using AngularJS.