Reputation: 949
So I am just starting up with Angular and for some reason angular is throwing an error saying my module is unavailable.
https://docs.angularjs.org/error/$injector/nomod?p0=plopApp
Here is my code so far: (super basic with no real functionality)
@section scripts{
<script src="/Scripts/branding/views.js" type="text/javascript"></script>
}
<h2>Branding Management</h2>
<div ng-app="plopApp">
<div ng-controller="BrandingController">
<div></div>
<div></div>
<div></div>
</div>
</div>
Seperate views.js
(function () {
var mod = angular.module('plopApp', []);
mod.controller('BrandingController', ['$scope', function ($scope) {
$scope.greeting = 'Hola!';
}]);
});
Thanks in advance!
EDIT: I forgot to add that my project does reference the angular libraries
Upvotes: 0
Views: 41
Reputation: 191729
You never actually call the function that wraps the call to angular.module
.
(function () {
var mod = angular.module('plopApp', []);
mod.controller('BrandingController', ['$scope', function ($scope) {
$scope.greeting = 'Hola!';
}]);
})() // parentheses call this function
I would also say that this wrapping is unnecessary since you don't need to assign to mod
and can also use angular.module('plopApp')
to read it, but there is nothing inherently wrong with this style either.
Upvotes: 2