I am trying to implement a simple controller to output navigation items:
in index.html I have the following:
<nav ng-controller="Nav">
<ul>
<li ng-repeat="c in catalog">
{{c.name}}
<p>{{c.url}}</p>
</li>
</ul>
</nav>
and in controllers.js I have:
'use strict';
/* Controllers */
angular.module('c.controllers', []).
controller('MyCtrl1', [function() {
}])
.controller('MyCtrl2', [function() {
}])
.controller('Nav', function Nav($scope) {
$scope.catalog = [
{'name': 'Nav 1',
'url': '#/view1'},
{'name': 'Nav 2',
'url': '#/view2'},
{'name': 'Nav 3',
'url': '#/view3'}
];
});
It doesnt work though, the repeat dosnt work and i just get the following output:
<nav ng-controller="Nav">
<ul>
<li ng-repeat="c in catalog">
{{c.name}}
<p>{{c.url}}</p>
</li>
</ul>
</nav>
Have have I done wrong, or havent done at all?
EDIT:
I have the following on my html tag:
<html lang="en" ng-app="myApp">
I can see the following error in the console:
Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:modulerr] Failed to instantiate module myApp.controllers due to:
Error: [$injector:nomod] Module 'myApp.controllers' 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