不知道如何争论我的javascript依赖关系
Unsure of how to wrangle my javascript dependencies
我使用的是NPM和一些角度包。我正在努力遵循本教程,第1部分:基本网格链接
我的文件目录设置是:
D:/nodStuff/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;
}
角度触摸的模块名称为ngTouch
(请参阅https://docs.angularjs.org/api/ngTouch)。尝试将javascript更改为
var app = angular.module('app', ['ngTouch', 'ui.grid']);
相关文章:
- 单元测试依赖关系没有被嘲笑
- FRP 中 EventStreams 的循环依赖关系
- 节点模块依赖关系
- 在Meteor中使用具有依赖关系的NPM包
- requirejs定义:嵌套依赖关系
- Django管道和javascript依赖关系
- 在Aurelia computeds中,当设置依赖关系时,如何声明对对象属性的依赖关系
- Npm未满足对等依赖关系
- Node.JS处理重复的可传递依赖关系
- 在Firefox上使用聚合物的javascript依赖关系的HTML导入困难;Safari
- 库中的匿名定义()模块's的依赖关系导致库损坏'的家属
- 使用Require.js按照依赖关系的顺序加载JavaScript
- GraphQL代码中的Javascript循环依赖关系
- 使用 grunt 检查单个 javascript 文件时如何解决依赖关系
- 与超类的依赖关系
- 在 Angular JS 业力测试中管理依赖关系
- 在 webpack 中管理 jQuery 插件依赖关系
- requirejs+bower,bower组件中的路径和依赖关系
- 预构建的NPM包:如何为用户省去依赖关系
- 聚合物种子-自定义元素依赖关系