You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a number of places where I want to do some tree manipulation as soon as the tree data is loaded. This really gets to the root of some other unanswered issues about what happens when you load a tree with $resource. In my case, the ngResource call is wrapped in a service that returns tree data as a promise. Example:
This doesn't work at all. Yet if I do it in some delayed fashion (e.g. user pushes a button) it works fine.
I can't figure out if the problem is a scope/digest issue, though I don't think so. But I know this for sure: I don't want to fix it with $interval. And, while I could try to do some magic with directive 'require' that sees a little too intrusive into the privates of abnTree. So I'm looking for a cleaner solution.
The text was updated successfully, but these errors were encountered:
The cleanest way that I've found to do this sort of thing is to manipulate the data yourself in the promise. Instead of using the treeControl you can set expanded = true on the branches you want expanded, for example. It's basically duplicating code though. :\
The other problem is that this approach won't work for all the available treeControl functions. I'm not sure how to asynchronously set the selected branch, since that's tracked internally by ABNTree in the select_branch function. You can still do it in your data, but the function won't track your initially selected branch.
I have a number of places where I want to do some tree manipulation as soon as the tree data is loaded. This really gets to the root of some other unanswered issues about what happens when you load a tree with $resource. In my case, the ngResource call is wrapped in a service that returns tree data as a promise. Example:
This doesn't work at all. Yet if I do it in some delayed fashion (e.g. user pushes a button) it works fine.
I can't figure out if the problem is a scope/digest issue, though I don't think so. But I know this for sure: I don't want to fix it with $interval. And, while I could try to do some magic with directive 'require' that sees a little too intrusive into the privates of abnTree. So I'm looking for a cleaner solution.
The text was updated successfully, but these errors were encountered: