角度jstree没有显示

时间:2015-10-31 01:57:56

标签: angularjs jstree

我试图在加载的ng-veiw中显示ngjstree,但树没有显示出来 这是我的html定义:

app.registerCtrl('OrgChartCtrl', ['$scope', '$http', function ($scope, $http) {

    $scope.treeConfig = {
        core: {
            multiple: false,
            error: function (error) {
                alert('treeCtrl: error from js tree - ' + angular.toJson(error));
            },
        },
        version: 1
    }
    $scope.$on('$viewContentLoaded', function () {
        alert("");
        $scope.treeData = [
            { id: 'ajson1', parent: '#', text: 'Simple root node' },
            { id: 'ajson2', parent: '#', text: 'Root node 2' },
            { id: 'ajson3', parent: 'ajson2', text: 'Child 1' },
            { id: 'ajson4', parent: 'ajson2', text: 'Child 2' }
        ];
        $scope.treeConfig.version++;

    });

    this.applyModelChanges = function () {
        return true;
    };

这是我注入角度的控制器:

header()

我也尝试在没有ViewContextLoaded的情况下做到这一点,但它也没有成功。

任何想法?

1 个答案:

答案 0 :(得分:0)

我忘记将'ngJsTree'添加到我的角度应用模块集合中。见:

var app = angular.module('App', [
    'ngGrid',
    'ngJsTree',
    'ngRoute'//   
]);