I have the following code in html file
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head >
<title></title>
<script src="Scripts/angular.min.js"></script>
<link href="Styles.css" rel="stylesheet"
</head>
<body ng-app="FirstModule">
<div ng-controller="myController">
<table>
<thead>
<tr>
<th>Name</th>
<th>Likes</th>
<th>DisLikes</th>
<th>Likes/Dislikes</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="technology in technologies">
<td>{{ technology.name}}</td>
<td>{{ technology.likes}}</td>
<td>{{ technology.dislikes}}</td>
<td>
<input type="button" value="Like" ng-click="incrementLikes(technology)" />
<input type="button" value="Like" ng-click="incrementDisLikes(technology)" />
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
And the code in js is
/// <reference path="angular.min.js" />
var myApp = angular.module("FirstModule", []);
var myController = function ($scope) {
var technologies = [
{ name: "C#", likes: 0, dislikes: 0 },
{ name: "ASP.NET", likes: 0, dislikes: 0 },
{ name: "SQL", likes: 0, dislikes: 0 },
{ name: "AngularJS", likes: 0, dislikes: 0 },
];
$scope.technologies = technologies;
$scope.incrementLikes = function (technology) {
$scope.incrementLikes++;
}
$scope.incrementDisLikes = function (technology) {
$scope.incrementDisLikes++;
}
};
myApp.controller("myController", myController);
I am getting the following error as Error: $injector:modulerr Module Error. I am new to angularjs and trying to learn event handling. On button click likes count will increase and same for dislikes.
ngAppdeclared asMyModule- but in code you haveFirstModule- you also haveMyControllervsmyController