Ng-controller
is used to give the controller name to html block of code. So if you want to add method that will be called on some event like click etc then that will be defined and declared in controller. HTML:
And here is the JS snippet: var app = angular.module('myApp', []); app.controller('myCtrl', function ($scope) { $scope.firstName = "LearnKode"; });