如何在 AngularJS 中使用 jsTree 事件 [英] How to use jsTree events with AngularJS
本文介绍了如何在 AngularJS 中使用 jsTree 事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 AngularJS
中的指令成功加载了我的树.现在我想在我的树中添加事件(这里选择节点),所以我这样做了.但我看不到我的提醒.
I load my tree successfully using a directive in AngularJS
.Now i want to add events (here select node) in my tree, so i did like this. but i can't see my alert .
我的代码:
app.directive('jstree', function() {
return {
restrict: 'A',
scope: {
jstree: '='
},
link: function(scope, element, attrs)
{
scope.$watch('jstree', function()
{
$(element).jstree({
"json_data" :{
"data":scope.jstree.data
},
"themes" : {
"theme" : "classic",
"dots" : true,
"icons" : true
},
"plugins" : [ "themes", "json_data" ]
}, false);
}, true);
// select a node
element.bind("select_node.jstree",function(e, data) {
$window.alert(e.data);
});
}
};
});
知道我做错了吗?
推荐答案
要在 jstree 中使用事件,必须在这一行添加ui":
to use events in jstree , you have to add "ui" in this line :
"plugins" : [ "themes", "json_data", "ui" ].
"plugins" : [ "themes", "json_data", "ui" ].
现在可以了.
这篇关于如何在 AngularJS 中使用 jsTree 事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文