angular-equal-1

 

angular.equal is used to compare between two int values whether these are same or not and the return value is true or false. See the code snippet:

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Welcome in the AngularJS</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app="app"> <div ng-controller="equalsController"> A<input type="number" ng-model="val1" ng-change="checkValue()" /><br /> B<input type="number" ng-model="val2" ng-change="checkValue()" /><br /> {{msg}} </div> </body> </html> <script> var app = angular.module("app", []); app.controller('equalsController', ['$scope', function ($scope) { $scope.val1 = 2; $scope.val2 = 3; $scope.checkValue = function () { if (angular.equals($scope.val1, $scope.val2)) $scope.msg = "Values are equal."; else $scope.msg = "Values are not equal."; } }]); </script>
Output