1
私はjstreeとangularjsで作業しています。ノードのパスと名前がありますが、ページに表示できません。私のミスはどこですか?私は自分の問題でng-treeディレクティブでplunker(作業中)の例を更新しました。今ではここangleはスコープ変数を表示しません(完了)
も、私はplunkerのコードを提供するHTMLの私のアプリ
にかなり近いです:
<h1>Where is my variable?!</h1>
<div>{{ test }}</div>
<pre>Path to A: {{ pathA }}</pre>
<pre>Path to B: {{ pathB }}</pre>
<pre>Path to C:{{ pathC }}</pre>
<js-tree tree-data="json" tree-src="tree.json"
tree-events="changed:callback;"></js-tree>
のJs
$scope.test = "I'm test variable"
$scope.callback = function (e, data) {
// ===== Click event on node for Industry =====
for (var i = 0; i < data.selected.length; i++) {
var parentNodeId = data.instance.get_node(data.selected[i]).parent;
var parentNodeText = data.instance.get_node(parentNodeId).text;
var selectedNodes = data.instance.get_selected();
var node = data.instance.get_node(data.selected[i]).text;
console.log(node);
if (node == "a"){
console.log($scope.pathA)
$scope.pathA = data.instance.get_path(data.node,'/');
}
else if (node == "b"){
console.log($scope.pathA)
$scope.pathB = data.instance.get_path(data.node,'/');
}
else if (node == "c"){
console.log($scope.pathA)
$scope.pathC = data.instance.get_path(data.node,'/');
}
// and etc....
}
}
あなたは本当に[js-treeの角型に切り替えるもの](https://github.com/ezraroi/ngJsTree) –
@PankajParkar、私はアプリで[別のjs-tree angle指令](https://github.com/arvindr21/jsTree-directive)を使用しています。私は単純な例を提供しました – Anton
あなたのコードはjQueryバージョンしか表示していませんでした。それを使って何も実装されていませんでした。 –