I using ng-js-tree <https://github.com/ezraroi/ngJsTree>
I loading tree from json and trying to collapse all nodes using two ways(state.opened and close\_all):

```
    $http.get('resources/json/mkb10.json')
    .then(function(res){
        $scope.cond.treeData = res.data;
        if (data !== undefined){

            for (var i = 0; i < $scope.cond.treeData.length; i++){
                $scope.cond.treeData[i].state = {};
                for (var j = 0; j < data.cond.length; j++)
                    if ($scope.cond.treeData[i].id == data.cond[j]){
                        $scope.cond.treeData[i].state = {selected: true};
                    }
                $scope.cond.treeData[i].state.opened = false;
            }
        }
        $scope.treeInstance.jstree(true).close_all();
        $scope.treeConfig.version++;
        $scope.treeInstance.jstree(true).close_all();
    });

```

my result is:
 [![enter image description here](https://i.stack.imgur.com/tJYTu.png)](https://i.stack.imgur.com/tJYTu.png)

But both of them no needed result.
Who know, how collapse all nodes? Thanks!

I writed [plunker](http://plnkr.co/edit/CVdqRnElOJF5hNADdKih?p=preview) for example

I want to get this view:
[![enter image description here](https://i.stack.imgur.com/1J3zu.jpg)](https://i.stack.imgur.com/1J3zu.jpg)