While attempting to execute the code provided below, I am encountering the following error: Argument
'MyController' is not a function, got undefined
.
<!DOCTYPE html>
<html lang="en" ng-app>
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<title>Hello world from Prateek</title>
</head>
<body>
<div ng-controller="MyController">
<h1>{{author.name}}</h1>
<p>{{author.title + ', ' + author.company}}</p>
</div>
<script>
function MyController($scope) {
$scope.author = {
'name': 'J Doe',
'title': 'Designer',
'company': 'ABC XYZ'
}
}
</script>
</body>
</html>
Instead of getting the expected output displaying name, title, and company, the actual output is as follows:
{{author.name}}
{{author.title + ', ' + author.company}}