JElster
asked on
Help with AngularJS - Error: [$injector:nomod] Module 'app' is not available!
Any idea why this error occurs?
Error: [$injector:nomod] Module 'app' is not available!
http://jsfiddle.net/JElster/me5Lcvsq/1/
<div ng-app="app" ng-controller="ctrl">
{{catalog}}
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js"></script>
var app = angular.module('app', ['jsonService']);
angular.module('jsonServic e', ['ngResource'])
.factory('JsonService', function($resource) {
return $resource('https://s3-us-west-2.amazonaws.com/s.cdpn.io/93930/catalog.json');
});
app.controller('ctrl', function($scope, JsonService){
JsonService.get(function(d ata){
$scope.catalog = data;
});
});
Error: [$injector:nomod] Module 'app' is not available!
http://jsfiddle.net/JElster/me5Lcvsq/1/
<div ng-app="app" ng-controller="ctrl">
{{catalog}}
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js"></script>
var app = angular.module('app', ['jsonService']);
angular.module('jsonServic
.factory('JsonService', function($resource) {
return $resource('https://s3-us-west-2.amazonaws.com/s.cdpn.io/93930/catalog.json');
});
app.controller('ctrl', function($scope, JsonService){
JsonService.get(function(d
$scope.catalog = data;
});
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Where are you adding your javascript that contains the module?
It should be added after the angularjs javascript file reference.
Do you have any other javascript errors in the console?
Disn't you forget to add the reference to the javascript file that contains the code (happens very often)?
It should be added after the angularjs javascript file reference.
Do you have any other javascript errors in the console?
Disn't you forget to add the reference to the javascript file that contains the code (happens very often)?
ASKER
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:nomod] Module 'app' 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.