Currently, I am enrolled in the AngularJS course on egghead.io and have encountered an issue that seems to be a common problem for others as well. Despite trying various solutions found here, none seem to work for me. In the second lesson video, the instructor demonstrates how to connect controllers to ng-apps. I have followed the instructions in the video precisely, restarted multiple times, and attempted different fixes suggested here. However, I keep encountering the following error in the console:
https://i.sstatic.net/MQxbu.png
Among the numerous errors displayed, the initial one caught my attention which reads:
"FirstCtrl' is not a function, got undefined"
Does anyone have a solution to this issue? Has there been any change in the Angular specifications regarding controller assignments or is the course omitting some vital information?
Code:
function FirstCtrl($scope) {
$scope.data = {
message: "Hello"
};
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8>
<title>My Angular App</title><link href='https://fonts.googleapis.com/css?family=Roboto|Roboto+Condensed:700' rel='stylesheet' type='text/css'></head>
<body>
<div ng-app="">
<div ng-controller="FirstCtrl">
<h1>You said:</h1>
<h3>{{data.message}}</h3>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script></body>
</html>