Skip to content
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 in controller #8

Closed
teo89 opened this issue Nov 14, 2014 · 8 comments
Closed

Tree Instance undefined in controller #8

teo89 opened this issue Nov 14, 2014 · 8 comments
Assignees

Comments

@teo89
Copy link

teo89 commented Nov 14, 2014

In your example "Using the Js Tree API from your controller" you say that i need only to use tree attribute and if i go to my controller i can call a method of Js Tree but the treeInstance is undefined. I saw your demo but there is no use of this attribute in the treeCtr.js. Any suggestions to make it work because i couldn't even in your demo.
thanks

@ezraroi
Copy link
Owner

ezraroi commented Nov 14, 2014

Hi, I am using the tree instance in another project that i developed using the ngJsTree. Can you write a plunker with code example?

@ezraroi
Copy link
Owner

ezraroi commented Nov 14, 2014

Are you using the controllerAs syntax? looks like there is bug the makes it not work with controllerAs.

@ezraroi ezraroi self-assigned this Nov 14, 2014
@ezraroi
Copy link
Owner

ezraroi commented Nov 14, 2014

Fixed in 0.0.3

@teo89
Copy link
Author

teo89 commented Nov 17, 2014

Hello, i made a simple example in plunker(http://plnkr.co/edit/VPyWFvQi8mKz9PoGjxmo?p=preview) please check the treeInstance console.log in treeCtrl.js is undefined.
Note: I could not load style.css in plunker. For this reasons some things don't work.

@ezraroi
Copy link
Owner

ezraroi commented Nov 17, 2014

Are you using the new version?

@ezraroi
Copy link
Owner

ezraroi commented Nov 17, 2014

The treeInstance will not be ready on the controller in this stage, it will be ready only after the contoller is created and the tree is created. when you print to the log the tree is not yet created, this is why you see undefined

@ezraroi
Copy link
Owner

ezraroi commented Nov 17, 2014

I forked your plunker and fixed it, take a look here http://plnkr.co/edit/1PHjOqojZsVlQmP819PW?p=preview

@teo89
Copy link
Author

teo89 commented Nov 17, 2014

Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants