angular-equal-4

 

angular.equal will check If Password field have same values then it will return true otherwise 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"> Password: <input type="password" ng-model="pass" /> Confirm Password: <input type="password" ng-model="cofirmPass" ng-change="isPasswordMatched()" /><br /> <p ng-show="isMatch" style="color:green">Password is matched</p> <p ng-hide="isMatch || cofirmPass==null" style="color:red">Password is not match</p> </div> </body> </html> <script> var app = angular.module("app", []); app.controller('equalsController', ['$scope', function ($scope) { $scope.isPasswordMatched = function () { $scope.isMatch = angular.equals($scope.pass, $scope.cofirmPass); } }]); </script>
Output