I am beginner to angularjs and I am writing a simple application to get started with it. I keep getting this error Error: [ng:areq] customerController not a function got undefined
I have tried to check whats wrong with my code and everything seems alright (at least for me). Kindly go through the code and help me out
Home.html
<html ng-app="customerApp">
<head>
<title> MyProject</title>
</head>
<body ng-controller="customerController">
<table border="2">
<thead>
<th ng-click="doSort('name')">Name</th>
<th ng-click="doSort('city')">City</th>
</thead>
<tr ng-repeat="cust in customers | filter: customerFilter | orderBy:sortBy:reverse">
<td>{{ cust.name }}</td>
<td>{{ cust.city }}</td>
</tr>
</table>
<br \>
<br \>
Total customers: {{ customers.length }}
<script src="/scripts/angular.min.js"></script>
<script src="/app/app.js"></script>
<script src="/app/controllers/customerController.js"</script>
</body>
</html>
app.js
(function(){
var app = angular.module('customerApp', []);
})();
customerController.js
(function (){
var customerController = function ($scope){
$scope.sortBy='name';
$scope.reverse=false;
$scope.customers= [{name:'Sachin',city:'Dharwad'}, {name:'Karan',city:'Hubli'},{name:'Shishir',city:'Mysore'}];
$scope.doSort= function (propName){
$scope.sortBy= propName;
$scope.reverse= !$scope.reverse;
};
};
customerController.$inject = ['$scope'];
angular.module('customerApp').controller('customerController',customerController );
})();
PS: I have already referred this question