I am new to AngularJS and I keep getting the above error from the Firebug console. My code:
index.html:
<html ng-app manifest="/manifest.appcache">
<head>
<meta charset="utf-8">
<script src="/public/js/angular.js"></script>
<script src="/public/js/client/spa_common.js"></script>
<!-- snip -->
</head>
<body>
<div id="main">
<h1 ng-controller="titleCtrl">{{title}}</h1>
</div>
</body>
</html>
spa_common.js:
"use strict"
angular
.module('title_stuff', [])
.service('titleSvc', ['$rootScope',
function($rootScope) {
this.getTitle = function() {
return ('Dashboard');
}
}
])
.controller('titleCtrl', ['titleSvc', '$scope',
function(titleSvc, $scope) {
$scope.title = titleSvc.getTitle();
}
]);
I am running this from node.js rendering index.html with Jade.
I can confirm that both my local copy of angular.js and spa_common.js are being loaded.
From what I've read:
- The ng-app value does not need to be set
- The module name can be set to anything, and can be reused by omitting the []
- You inject the module name into the controller's argument array
- The controller's name must match the ng-controller directive in the HTML tag
I've been banging my head against a wall for days. Hopefully someone has a solution?