If the object model changes, you can use $scope. $watch monitor changes
<HTMLNg-app= "myApp"><Head><title>Angularjs-demo</title><Scripttype= "text/javascript"src= "lib/angularjs/angular.min.js"CharSet= "utf-8"></Script></Head><BodyNg-controller= "ctrl"><inputtype= "text"Ng-model= "text1"ng-model-options= "{updateon: ' Blur '}" /><Div>Number of input box contents changed: {{count}}</Div></Body><Scripttype= "text/javascript">varapp=Angular.module ('myApp', []). Controller ('Ctrl', function($scope) {$scope. Count= 0; $scope. $watch ('Text1',function() {$scope. Count++; });});</Script></HTML>
Change it a little bit, output the content before and after the Modification:
<HTMLNg-app= "myApp"><Head><title>Angularjs-demo</title><Scripttype= "text/javascript"src= "lib/angularjs/angular.min.js"CharSet= "utf-8"></Script></Head><BodyNg-controller= "ctrl"><inputtype= "text"Ng-model= "text1"ng-model-options= "{updateon: ' Blur '}" /><Div>Number of input box contents changed: {{count}}</Div><Div>Original Content: {{content1}}</Div><Div>New Content: {{content2}}</Div></Body><Scripttype= "text/javascript">varapp=Angular.module ('myApp', []). Controller ('Ctrl', function($scope) {$scope. Count= 0; $scope. $watch ('Text1',function(newvalue,oldvalue) {$scope. Count++; $scope. Content1=oldValue; $scope. Content2=newvalue; });});</Script></HTML>
Angularjs using $scope. $watch Monitor the change of the object model