I am doing a very simple task, just establish a connection between the container
of the index.html
and the controller.js
. Problem is, when I open the console on the browser does not print anything but throws:
Error: $controller:ctrlreg A controller with this name is not registered.
Here is my eventController.js file:
function AppCtrl() {
console.log("Event Controller");
}
and this is the index:
<!DOCTYPE>
<html ng-app>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<title>trafiyaAPI</title>
</head>
<body>
<div class="container" ng-controller="AppCtrl">
<h1>API</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Long</th>
<th>Lat</th>
<th>Address</th>
<th>Date</th>
</tr>
</thead>
</table>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.min.js"></script>
<script src="../controllers/controllerEvent.js"></script>
</body>
The structure of the project is:
I appreciate any help