如何使用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 .
我的code:
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);
});
}
};
});
任何想法是我错在哪里?
Any idea were i went wrong ?
推荐答案
要使用jstree事件,你必须在这行添加UI
to use events in jstree , you have to add "ui" in this line :
插件:[主题,json_data,UI]
"plugins" : [ "themes", "json_data", "ui" ].
现在它的工作原理。
这篇关于如何使用AngularJS jsTree事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文