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"> Male: <input type="radio" ng-model="radio1" value="Male" ng-change="layout(radio1)" /> Female: <input type="radio" ng-model="radio2" value="Female" ng-change="layout(radio2)" /> <pre><b>Changed</b> {{radio1}} </pre> </div> </div> </div> <script> var app = angular.module("changeExample", []); app.controller('ExampleController', ['$scope', function ($scope) { $scope.layout = function (rdo) { $scope.radio1 = rdo; $scope.radio2 = rdo; } }]); </script> </body> </html>