2017-11-15 3 views
0

ich meine app.js haben:

angular.module('myApp', ['ui.tree']) 
    .controller('myCtrl', function($scope) { 
    $scope.remove = function(scope) { 
     scope.remove(); 
    }; 

    $scope.toggle = function(scope) { 
     scope.toggle(); 
    }; 

    $scope.moveLastToTheBeginning = function() { 
     var a = $scope.data.pop(); 
     $scope.data.splice(0, 0, a); 
    }; 

    $scope.newSubItem = function(scope) { 
     var nodeData = scope.$modelValue; 
     nodeData.nodes.push({ 
     id: nodeData.id * 10 + nodeData.nodes.length, 
     title: nodeData.title + '.' + (nodeData.nodes.length + 1), 
     nodes: [] 
     }); 
    }; 

    $scope.collapseAll = function() { 
     $scope.$broadcast('angular-ui-tree:collapse-all'); 
    }; 

    $scope.expandAll = function() { 
     $scope.$broadcast('angular-ui-tree:expand-all'); 
    }; 

Die index.html beginnt mit:

<script type="text/javascript" src="angular.min.js"></script> 
<script type="text/javascript" src="angular-ui-tree.min.js"></script> 
<link rel="stylesheet" type="text/css" href="angular-ui-tree.min.css"> 
<link rel="stylesheet" type="text/css" href="bootstrap.min.css"> 

<div ng-app="myApp"> 
    <div ng-controller="myCtrl"> 
    <!-- Nested node template --> 

Ich habe Winkel-ui-Baum .min.js und angular.min.js im selben Ordner wie app.js. Noch die folgenden Fehler bekommen:

angular.min.js:6 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.11/$injector/modulerr?p0=myApp&p1=Error%3A%20%5B%24injector%3Anomod%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.5.11%2F%24injector%2Fnomod%3Fp0%3DmyApp%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A8000%2Fangular.min.js%3A6%3A426%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A8000%2Fangular.min.js%3A25%3A235%0A%20%20%20%20at%20b%20(http%3A%2F%2Flocalhost%3A8000%2Fangular.min.js%3A24%3A282)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A8000%2Fangular.min.js%3A25%3A20%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A8000%2Fangular.min.js%3A40%3A17%0A%20%20%20%20at%20q%20(http%3A%2F%2Flocalhost%3A8000%2Fangular.min.js%3A7%3A371)%0A%20%20%20%20at%20g%20(http%3A%2F%2Flocalhost%3A8000%2Fangular.min.js%3A39%3A382)%0A%20%20%20%20at%20fb%20(http%3A%2F%2Flocalhost%3A8000%2Fangular.min.js%3A43%3A381)%0A%20%20%20%20at%20c%20(http%3A%2F%2Flocalhost%3A8000%2Fangular.min.js%3A21%3A19)%0A%20%20%20%20at%20Gc%20(http%3A%2F%2Flocalhost%3A8000%2Fangular.min.js%3A21%3A332) 
    at angular.min.js:6 
    at angular.min.js:40 
    at q (angular.min.js:7) 
    at g (angular.min.js:39) 
    at fb (angular.min.js:43) 
    at c (angular.min.js:21) 
    at Gc (angular.min.js:21) 
    at se (angular.min.js:20) 
    at angular.min.js:323 
    at HTMLDocument.b (angular.min.js:192) 
+0

Check Versionen mb –

Antwort

0

Wie in den Kommentaren gesagt, es könnte ein Fehler in Versionen (Angular & UI Baum) sein.

Sehen Sie diese Plunkr Arbeits: https://plnkr.co/edit/U2U5vMi7m9G8BzC494ma?p=preview

<head> 
    <script data-require="[email protected]" data-semver="1.6.5" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.min.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-tree/2.22.6/angular-ui-tree.min.js"></script> 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-tree/2.22.6/angular-ui-tree.min.css" /> 
    <link rel="stylesheet" href="style.css" /> 
    <script src="script.js"></script> 
    </head> 
Verwandte Themen