scope.tree.jstree() undefined
See original GitHub issueI don’t know if it’s the problem of jstree 3.0.9, but when installed this directive, it shows scope.tree.jstree('destroy')
undefined. But when I change it to $(scope.tree).jstree('destroy')
it works.
So I think before you assign the elm
to scope.tree
, you need to wrap it with jQuery. So I modified your function a little bit:
scope.destroy = function () {
var j_elm = $(elm);
if (attrs.tree) {
if (attrs.tree.indexOf('.') !== -1) {
var split = attrs.tree.split('.');
scope.tree = scope.$parent[split[0]][split[1]] = j_elm;
}
else {
scope.tree = scope.$parent[attrs.tree] = j_elm;
}
} else {
scope.tree = j_elm;
}
scope.tree.jstree('destroy');
};
Issue Analytics
- State:
- Created 9 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
ngJsTree TypeError: scope.tree.jstree is not a function
I have included needed dependencies and the ngJsTree module to my app.module. But this still happens: angular.js:13424 TypeError: ...
Read more >$scope.treeInstance is undefined · Issue #36 · ezraroi/ngJsTree
my template: <div js-tree="treeConfig" ng-model="treeData" tree="treeInstance">. and got: Error: $scope.treeInstance is undefined.
Read more >API - jsTree
a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to...
Read more >node is undefined in function "change_state.jstree"
Ivan, I have a problem with getting node id in function "change_state.jstree". In addition, I am triggering "change_state" with "select_node" on
Read more >rollup.js
tryCatchDeoptimization Do not turn off try-catch-tree-shaking --no-treeshake. ... rollup-plugin-my-example.js export default function myExample () { return ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try to add this:
<link rel="stylesheet" href="bower_components/jstree/dist/themes/default/style.css" />ok, I found the problem. My bad, I load the javascript in a wrong sequence, the jQuery.js should be loaded before angular.js, otherwise angular will only wrap the
elm
object with its own jqlite. I will remove this commit from the pull request.