I'm trying to make my first controller and getting this error:
Error: [ng:areq] Argument 'TestController' is not a function, got undefined
I've simplified my code to find the error but no luck. It looks to my like I'm creating the controller and the books array in the script and referencing the controller letter by letter in the div. What am I missing?
<!doctype html>
<html data-ng-app>
<head>
<meta charset="utf-8"/>
</head>
<body>
<div data-ng-controller="TestController">
<ul>
<li data-ng-repeat="b in books">{{ b.title + ' by ' + b.author }}</li>
</ul>
</div>
<script src="angular.js"></script>
<script>
function TestController() {
this.books = [{title: 'Angela', author: 'Donald Duck'}, {title: 'Angles', author: 'Dirty Harry'}];
}
</script>
</body>
</html>