JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="frmVal">
<div ng-controller="FrmCtrl">
Password <input type="text" ng-model="pwd" /> <br/>
Conform Password <input type="text" ng-model="cpwd" /><br/>
<div class="error" ng-show="isMatch"> Do not Match</div>
</div>
</div>
CSS
.error {
color: red;
}
JavaScript
var app = angular.module('frmVal',[]);
app.controller('FrmCtrl', function($scope){
$scope.pwd = "";
$scope.cpwd = "";
$scope.isMatch = true;
$scope.$watch('pwd', function(newValue, oldValue){
if(newValue == $scope.cpwd)
{
$scope.isMatch = false;
} else {
$scope.isMatch = true;
}
});
$scope.$watch('cpwd', function(newValue, oldValue){
if(newValue == $scope.pwd)
{
$scope.isMatch = false;
} else {
$scope.isMatch = true;
}
});
});