2016-04-17 89 views
0

我正在使用NPM和一些角度包。我想按照這個教程,第1部分:基本電網link不確定如何解決我的JavaScript依賴關係

我的文件目錄的設置是:

d:/ nodeStuff/uiGrid,其中包含:

node_modules uigrid.css uigrid.html uigrid.js 

的node_modules文件夾包含:

angular angular-animate angular-touch angular-ui-grid 

我不能在我的瀏覽器控制檯解決這個錯誤:

angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to: 
Error: [$injector:modulerr] Failed to instantiate module angular-touch due to: 
Error: [$injector:nomod] Module 'angular-touch' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 

我知道教學提供的jsfiddle,但它在CSS進口依賴(是正常的嗎?)和我難倒就如何讓它在外面工作的jsfiddle

我的HTML:

<script src="./node_modules/angular/angular.js"></script> 
<link rel="stylesheet" type="text/css" href="./node_modules/angular-ui-grid/ui-grid.css" /> 
<script src="./node_modules/angular-ui-grid/ui-grid.js"></script> 
<script src="./node_modules/angular-touch/angular-touch.js"></script> 
<script src="./uigrid.js"></script> 

<div ng-app="app"> 
    <div ng-controller="MainCtrl"> 
     <div ui-grid="{ data: myData }" class="grid"></div> 
    </div> 
</div> 

我的javascript:

var app = angular.module('app', ['angular-touch', 'ui.grid']); 
app.controller('MainCtrl', ['$scope', function ($scope) { 
    $scope.myData = [{ 
     "firstName": "Cox", 
     "lastName": "Carney", 
     "company": "Enormo", 
     "employed": true 
    }, { 
     "firstName": "Lorraine", 
     "lastName": "Wise", 
     "company": "Comveyer", 
     "employed": false 
    }, { 
     "firstName": "Nancy", 
     "lastName": "Waters", 
     "company": "Fuelton", 
     "employed": false 
    }]; 
}]); 

我的CSS:

.grid { 
    width: 500px; 
    height: 250px; 
} 

回答