smuggledPancakes smuggledPancakes - 10 months ago 45
HTML Question

Unsure of how to wrangle my javascript dependencies

I am using NPM and some angular packages. I am trying to follow this tutorial, part 1: Basic Grid link

My file directory setup is:

D:/nodeStuff/uiGrid, which contains:

node_modules uigrid.css uigrid.html uigrid.js

The node_modules folder contains:

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

I can't solve this error in my browser console:

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.

I know the tutorial provides a jsfiddle, but it imported dependencies in the css (is that normal?) and I am stumped on how to make it work outside of jsfiddle

My 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>

My 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


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


The module name for angular-touch is ngTouch (see Try changing your javascript to

var app = angular.module('app', ['ngTouch', 'ui.grid']);