Recursive promises to create tree
问题 A tree api returns childrens when node element is passed to it. I pass the root node first and then on the basis of the nodes returned I pass all of them back recursively, if they have hasChildren parameter true. Is there a way to know when the function has finished creating the tree. function recursivelyFetchChildren(id, selectedAsset, parentId){ return ajaxCall(id, selectedAsset, parentId) .then(function(data){ //collects all childs in childs array childs.push(data); for(var i=0; i<data