I've got a really simple Angular JS application, and I cannot figure out why I'm getting an error: Error: [ng:areq] Argument 'CoursesController' is not a function, got undefined
My fiddle (you'll need to open up your browser dev tools to see error in console): http://jsfiddle.net/Y4c2q/
My Angular JS code:
'use strict';
console.log('reg module entry');
var registrationModule = angular.module('registrationModule', []);
registrationModule.controller('CoursesController', function ($scope, bootStrappedData) {
$scope.courses = bootStrappedData.courses;
console.log('inside of controller');
});
registrationModule.factory('bootStrappedData', function() {
console.log('bootstrapping our data');
return {
courses: [{"number":"aaa","name":"magical creatures","instructor":"John"},
{"number":"bbb","name":"ze dark arts","instructor":"Rob"},
{"number":"ccc","name":"third book","instructor":"Bran"}]
};
});
this is the HTML where I want to display my 3 rows of data:
<div ng-controller="CoursesController">
<table class="table table-condensed table-hover">
<tr>
<th>Course</th>
<th>Course Name</th>
<th>Instructor</th>
</tr>
<tr ng-repeat="course in courses">
<td>{{course.number}}</td>
<td>{{course.name}}</td>
<td>{{course.instructor}}</td>
</tr>
</table>
</div>
ng-appor manually? IsregistrationModulemarked as dependency for main application module?