Reputation: 430
I have a working page using AngularJS without any erros in the console. Now the odd part is that there are other pages where I'm not using AngularJS that do give the following error in the developer's console:
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.3.13/$injector/modulerr...
In all pages (including the ones that give errors but don't actively use AngularJS (yet)), the angular.min.js is loaded followed by angular-locale_nl-nl.js (content: https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.2.15/angular-locale_nl-nl.js), both in the head-section. I also load myApp.js in the head-section after that.
Content of myApp.js:
var myApp = angular.module('myApp',['']);
There is a data-ng-app=”myApp” attribute in the html-tag.
The only difference between the working Angular page and the ones that give an error is an Angular controller. In the working page at the bottom, before the closing-body tag I load myController.js which is a very basic controller manipulating a few $scope variables. There's a data-ng-controller=”myController” attribute in a div inside the page. This pages works perfectly fine. But in the other pages I'm not using Angular and I get an error in the console.
I'm new to Angular (keep that in mind when posting :-D), I hope my mistake is something that is easily fixed.
Upvotes: 1
Views: 351
Reputation: 6877
If you don't have dependencies to inject keep your array empty
var myApp = angular.module('myApp',[]);
Upvotes: 3