In this example we have a textbox and when you type in the textbox the value changes and on the change of the value we increment the value of count variable by 1 by calling function on the change event using the ng-change directive. The value of count variable is display below the textbox.

<!DOCTYPE html> <html xmlns=""> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src=""></script> </head> <body ng-app="changeExample"> <div ng-controller="ExampleController"> <div class="container"> <div class="col-md-3 well" ng-init="count=0"> First Name: <input type="text" class="form-control" ng-change="isTextChange()" ng-model="text" /> <pre><b>Changed</b> {{isChange}} {{count}} </pre> </div> </div> </div> <script> var app = angular.module("changeExample", []); app.controller('ExampleController', ['$scope', function ($scope) { $scope.isChange = false; $scope.isTextChange = function () { $scope.isChange = true; $scope.count = $scope.count + 1; } }]); </script> </body> </html>