【发布时间】:2016-01-04 14:41:50
【问题描述】:
我使用 Angular js 做了一个简单的 jstree 演示。我阅读了这个文档 https://github.com/ezraroi/ngJsTree做例子之前
两个codepen都有相同的JS代码。但是一个codepen显示“文件夹图像”而另一个不显示..为什么? http://codepen.io/anon/pen/mVRarZ?editors=101
http://codepen.io/anon/pen/JGEwPv?editors=101
如果我将第二个 codepen JS 代码替换为第一个 codepen js,它会显示文件夹..但我不明白 JS 有什么区别..为什么第一个 codepen 显示文件夹而另一个不显示
angular.module('app',['ngJsTree']).controller('myCtrl',function($scope,$log){
$scope.treeConfig = {
core : {
multiple : false,
animation: true,
error : function(error) {
$log.error('treeCtrl: error from js tree - ' + angular.toJson(error));
},
check_callback: true,
worker : true
},
types : {
default : {
icon : 'glyphicon glyphicon-flash'
},
star : {
icon : 'glyphicon glyphicon-star'
},
cloud : {
icon : 'glyphicon glyphicon-cloud'
}
},
version : 1,
plugins : ['types','checkbox']
};
$scope.originalData = [
{ id : 'ajson1', parent : '#', text : 'Simple root node', state: { opened: true} },
{ id : 'ajson2', parent : '#', text : 'Root node 2', state: { opened: true} },
{ id : 'ajson3', parent : 'ajson2', text : 'Child 1', state: { opened: true} },
{ id : 'ajson4', parent : 'ajson2', text : 'Child 2' , state: { opened: true}}
];
$scope.treeData = [];
angular.copy($scope.originalData,$scope.treeData);
})
【问题讨论】:
标签: angularjs angularjs-directive angularjs-scope angular-ui-router