I've recently started learning AngularJs and I'm facing an issue while using controllers to create a basic application. Unfortunately, I keep encountering an Error that I can't seem to resolve.
Error: ng:areq Bad Argument. Argument 'languages' is not a function, got undefined
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<title>Angular JS | Controllers</title>
<script type="text/javascript" src="../resources/js/angular.min.js"></script>
<script>
(function(angular){
var myApp = angular.module('myApp', []);
myApp.controller = ('languages', function($scope){
$scope.myFavLanguage = 'None';
});
})(window.angular);
</script>
</head>
<body >
<div ng-controller="languages">
Select your favourite langauge:
<button>ReactJS</button>
<button>PHP</button>
<button>JavaScript</button>
<button>C++</button>
<p>Your favourite language is {{myFavLanguage}}</p>
</div>
</body>
</html>
I have extensively researched online and checked various discussions on stackoverflow in an attempt to fix the issue, but none of them provided a solution. Here are some threads that I looked at along with others. Please review them before assuming it's a duplicate problem:
Angularjs bad argument ng:areq error
Angularjs: Error: [ng:areq] Argument 'HomeController' is not a function, got undefined
Argument ... is not a function, got undefined
Thanks for any assistance