ezraroi / ngJsTree

Angular Directive for the famous JS Tree
http://ezraroi.github.io/ngJsTree/
MIT License
270 stars 101 forks source link

TypeError: scope.tree.jstree is not a function ? #87

Closed phuwin1995 closed 8 years ago

phuwin1995 commented 8 years ago

I have no idea why this error is thrown. I have included all dependancies and add 'ngJsTree' into my app module;

   angular.js:13424 TypeError: scope.tree.jstree is not a function
    at m.scope.destroy (ngJsTree.min.js:243)
    at ngJsTree.min.js:286
    at m.$digest (angular.js:16869)
    at m.$apply (angular.js:17133)
    at g (angular.js:11454)
    at x (angular.js:11652)
    at XMLHttpRequest.v.onload (angular.js:11593)

My includes:

       <script src="js/angular.min.js"></script>
        <script src="js/angular-route.min.js"></script>
        /*<script src="js/lodash.js"></script>
        <script src="js/angularjs-dropdown-multiselect.js"></script>
        <script src="https://apis.google.com/js/client.js"></script>*/
        <script src="//cdnjs.cloudflare.com/ajax/libs/jstree/3.0.9/jstree.min.js"></script>
        <script src="js/ngJsTree.min.js"></script>

My app modules:

var app = angular.module('app', [
    'ngRoute','ngMaterial','angularjs-dropdown-multiselect','ngJsTree'
]);

My HTML:

<div js-tree="treeConfig" ng-model="googleDriveFiles" tree-events="ready:readyCB;changed:onItemChanged"></div>
ezraroi commented 8 years ago

You are missing jquery before angular

phuwin1995 commented 8 years ago

@ezraroi I have

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

in the <head></head>

ezraroi commented 8 years ago

Write a plunker that reproduce, you are doing something wrong for sure

phuwin1995 commented 8 years ago

@ezraroi I have solved the issue. Thanks for your help. There are 2 angular.min.js included. There is one in the head tag, and jquery is after that.