2015-10-31 46 views
-1

我試圖顯示加載NG-教職員一個ngjstree但樹在這裏不露面 是我的HTML定義:角jstree不顯示

<div js-tree="treeConfig" ng-model="treeData" should-apply="vm.applyModelChanges()"></div> 

,這裏是我注入的角度控制器:

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; 
    }; 

我也試圖做到這一點沒有ViewContextLoaded,但它也沒有工作。

任何想法?

回答

0

我忘了在我的角度應用程序模塊集合中添加'ngJsTree'。見:

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

這實際上幫助我,哈哈:D –