# ng-click doesn’t invoke method inside angularJs controller

I am trying to create an angular application from scratch. I have been trying to solve this for hours now, but I couldn’t make it work.
All the following files are placed inside a parent folder.

index.html

<!DOCTYPE html>
<html lang="en">

<title>Hello</title>
<script src="script.js"></script>

<body ng-app="app">
<h1>Student App</h1>
<section ng-controller="HelloController">
<h4>Enter Student Details</h4>
<label for="name">Name :</label>
<input id="name" type="text" ng-model="student.name" />
<p>Hello {{student.name}}!</p>
</section>
<button id="name" type="submit" ng-click="onButtonClick()">Click</button>

</body>

</html>


HelloController.js

  angular.module('app', [])
.controller('HelloController', ["$scope", function($scope) {

\$scope.onButtonClick = function()
{
console.log("method invoked");
};

}]);


It would be nice if someone could help me solve this problem I am facing.

Source: AngularJS