-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tree Instance undefined after the tree is successfully created #23
Comments
When do you print the TreeInstance to the console? |
I print the treeInstance in the readyCB event, just like it's done in your previous plunker example: http://plnkr.co/edit/1PHjOqojZsVlQmP819PW?p=preview I also created a button to print its value, like the one you have in your demo - "Call Method of Tree Instance" - but since the treeInstance is undefined, I get a "TypeError: Cannot read property 'jstree' of undefined" |
If you can't reproduce this in plunker, it will be very hard to for me to help. The treeInsrance property is working fine in tests and in my projects |
Same problem with jquery 2.1.3, angular 1.3.15, jsTree 3.1.0… |
Did you manage to reproduce on plunker? |
Sorry for the late response. I was finally able to retrieve the treeInstance. In my case, the only solution was to use the ng-controller directive to define the controller (which I avoid using in my project): <div ng-controller='myCtrl'>
<div js-tree="treeConfig" ng-model="treeData" tree="treeInstance"></div>
</div> I'm still unable to reproduce the working example of my first plunker or to get the treeInstance without having to use ng-controller. Thanks a lot for your help and for this great Angular directive! Keep up the good work :) |
Hi, Thanks for this very usefull work! |
Happy to see that the directive is being used and thanks for sharing your solutions |
Hi, I'm trying to create a directive for a Drag'n'drop tree using ngJsTree. The tree is created and works, but so far I've been unable to use the treeInstance, as it always shows up as "undefined".
I tried to adapt your solution from the #8, and created a new plunker with a simple example of my code, which surprisingly works as expected:
http://plnkr.co/edit/onimKl8iGNyYUkRENW5T?p=preview
In my real application, the console.log for the TreeInstance keeps showing up as undefined, although the implementation is pretty similar. In this Plunker example, I'm not using a controller, but I have tried both approaches with the same unsuccessful result.
Any idea of what might be the problem?
Thanks in advance!
The text was updated successfully, but these errors were encountered: