Comments (8)
When do you print the TreeInstance to the console?
if in the controller constructor it will not work, only after ready event of the tree is fired you can access it
from ngjstree.
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"
from ngjstree.
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
from ngjstree.
Same problem with jquery 2.1.3, angular 1.3.15, jsTree 3.1.0…
from ngjstree.
Did you manage to reproduce on plunker?
from ngjstree.
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 :)
from ngjstree.
Hi,
I had the same issue and solved it by adding ng-controller and (re)reference the instance in the controller like this:
ctrl.treeInstance = angular.element('#myDivTreeElement')
(just in case it helps)
Thanks for this very usefull work!
from ngjstree.
Happy to see that the directive is being used and thanks for sharing your solutions
from ngjstree.
Related Issues (20)
- search in Firefox causing unresponsive script window popup
- Custom directive for double click event on the tree elements
- support for angular 1.6.x HOT 2
- getting error on using ngJsTree in a modal
- Error for Adding Children
- custom json data
- Open ALL HOT 1
- Upgrade to AngularJS 1.6 HOT 3
- Question: angular 2+ version HOT 1
- context menu and dnd plugins updating model
- two way binding doesn't work inside a directive
- how to use ng-required in ngJsTree?
- Ajax Call
- Update of package on NPM HOT 1
- get_checked method problem
- Set language HOT 1
- Binding mousedown event HOT 1
- Support for Angular 8
- attach separate dnd_stop.vakata event to different selectors
- Can only select either ONE or ALL nodes at any given level
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngjstree.