wix-incubator / angular-tree-control

Angular JS Tree
http://wix.github.io/angular-tree-control
MIT License
708 stars 277 forks source link

Able to programatically trigger node expansion? #225

Closed adammodlin closed 8 years ago

adammodlin commented 8 years ago

Is it possible to programmatically trigger a node expansion? For example, I make an Ajax call and set my tree to those results. I then want to expand the root node. Any way to do this?

adammodlin commented 8 years ago

I was able to do this by getting the root element of the directive, finding the descendants with the ".tree-branch-head" class and doing:

angular.element(myMatchingElement).triggerHandler('click');