I am creating a web app in mvc-angularjs, I am using ngroute.
Angularjs controller in my layout with html code:
<div class="container body-content" ng-app="MyApp">
<br />
<br />
<br />
<div style="float:right;">
<a href="#" class="btn btn-danger">Sign Out</a>
</div>
@RenderBody()
<hr />
</div>
<script>
(function () {
var app = angular.module('MyApp', ['ngRoute', "ngStorage"]);
app.controller('myctrllayout', function ($scope) {
});
})();
</script>
and this is my welcome page:
<div ng-controller="welcome">
</div>
<script>
angular.module('MyApp',[])
.controller('welcome', function ($scope) {
});
</script>
when I run the code I got the following error
Error: $controller:ctrlreg A controller with this name is not registered.
The controller with the name 'welcome' is not registered.
when I change my app from ('MyApp',[]) to ('MyApp'):
Module 'MyApp' 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.