0

我想實現的角度。我jstree使用該插件 https://github.com/ezraroi/ngJsTree 我收到此錯誤爲什麼控制器不能在angiular js中工作?

b.tree.jstree不是一個函數

我遵循的所有步驟,並作出codepen但我的樹不顯示。

這裏是我的代碼 http://codepen.io/naveennsit/pen/qbRyVP?editors=101

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


}) 

任何更新?

回答

2

在你的設置,你首先包括角JS然後jQuery的,但看起來像jstree預計角度使用完整版本的jQuery,而不是jQuery的的精簡版

扭轉角和jQuery庫的順序包括:在設置的工作原理:

//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js 
//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.min.js 

更新codepen:http://codepen.io/anon/pen/OMWoYW?editors=101

相關問題