我试图使用angularui-tree并经过几天的努力使其在Vistulaforce(salesforce)页面中运行,它仍然显示一些错误或另一个。现在我试图运行基本的嵌套树ui示例,但它发生了错误,我无法理解为什么当我按照他们的指示完成所有操作时。任何人都可以。帮助我理解出了什么问题。
visualforce page
<apex:page showHeader="false">
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.4/angular.min.js"/>
<link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/angular-ui-tree/2.22.1/angular-ui-tree.min.css"/>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/angular-ui-tree/2.22.1/angular-ui-tree.min.js"/>
<link rel = "stylesheet" href = "https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css"/>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"/>
<script src = "//ajax.googleapis.com/ajax/libs/angularjs/1.5.0-beta.2/angular-sanitize.js"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script type="text/javascript">
var app = angular.module('MyApp', ['ui.tree']);
app.controller('treeCtrl', function($scope) {
$scope.tree1 = [];
$scope.tree1 = [{
'id': 1,
'title': 'tree1 - item1',
'nodes': []
}, {
'id': 2,
'title': 'tree1 - item2',
'nodes': []
}, {
'id': 3,
'title': 'tree1 - item3',
'nodes': []
}, {
'id': 4,
'title': 'tree1 - item4',
'nodes': []
}];
$scope.tree2 = [{
'id': 1,
'title': 'tree2 - item1',
'nodes': []
}, {
'id': 2,
'title': 'tree2 - item2',
'nodes': []
}, {
'id': 3,
'title': 'tree2 - item3',
'nodes': []
}, {
'id': 4,
'title': 'tree2 - item4',
'nodes': []
}];
$scope.remove = function (scope) {
scope.remove();
};
$scope.toggle = function (scope) {
scope.toggle();
};
$scope.newSubItem = function (scope) {
var nodeData = scope.$modelValue;
nodeData.nodes.push({
id: nodeData.id * 10 + nodeData.nodes.length,
title: nodeData.title + '.' + (nodeData.nodes.length + 1),
nodes: []
});
};
});
<div ng-app="MyApp">
<div ng-controller="treeCtrl">
<div ui-tree="ui-tree">
<ol ui-tree-nodes="" ng-model="tree1" id="tree-root">
<li ng-repeat="node in tree1" ui-tree-node="ui-tree-node" ng-include="'nodes_renderer.html'"></li>
</ol>
</div>
<script type="text/ng-template" id="nodes_renderer.html">
<div ui-tree-handle="ui-tree-handle">
{{node.title}}
</div>
<ol ui-tree-nodes="" ng-model="node.nodes">
<li ng-repeat="node in node.nodes" ui-tree-node="ui-tree-node" ng-include="'nodes_renderer.html'">
</li>
</ol>
</script>
</div>
</div>
答案 0 :(得分:0)
以下是angular-ui-tree
https://jsfiddle.net/hardiksondagar/gt00pr9x/
注意:不需要jQuery,因为angular-ui-tree基于Pure Javascript