我正在尝试使用angularjs来创建树视图,我收到了模块错误。我正在尝试关注此链接https://github.com/eu81273/angular.treeview
我按照步骤操作 添加了js和css文件 在html中添加了
<div data-angular-treeview="true"
data-tree-id="abc"
data-tree-model="treedata"
data-node-id="id"
data-node-label="label"
data-node-children="children">
</div>
然后在控制器
var CIController = angular.module('CIController', ['ngMaterial', 'ngAnimate', 'ngAria', 'ngMessages', 'Alertify', 'ngFileUpload', 'angularTreeview',])
$scope.treedata =
[
{
"label": "User", "id": "role1", "children": [
{ "label": "subUser1", "id": "role11", "children": [] },
{
"label": "subUser2", "id": "role12", "children": [
{
"label": "subUser2-1", "id": "role121", "children": [
{ "label": "subUser2-1-1", "id": "role1211", "children": [] },
{ "label": "subUser2-1-2", "id": "role1212", "children": [] }
]
}
]
}
]
},
{ "label": "Admin", "id": "role2", "children": [] },
{ "label": "Guest", "id": "role3", "children": [] }
];
$scope.$watch('abc.currentNode', function (newObj, oldObj) {
if ($scope.abc && angular.isObject($scope.abc.currentNode)) {
console.log('Node Selected!!');
console.log($scope.abc.currentNode);
}
}, false);
但是我在chorome控制台中遇到错误,比如模块错误。请帮助解决此问题。 AngularJS v1.3.15是我正在使用的版本。