angular-equal-2

 
In this example, we check if both checkbox have same value then it will return true otherwise it return 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"> Licence <input type="checkbox" ng-model="a" ng-change="isEqual()" /><br /> UID <input type="checkbox" ng-model="b" ng-change="isEqual()"><br /> <p ng-show="aa"> Both checkbox's have same value true or false. </p> <p ng-hide="aa"> Any one checkbox have different value . </p> </div> </body> </html> <script> var app = angular.module("app", []); app.controller('equalsController', ['$scope', function ($scope) { $scope.isEqual = function () { $scope.aa = angular.equals($scope.a, $scope.b); } }]); </script>
Output