client-ui
Version:
Testing implementation of nodeJs Backend, angular frontend, and hopefully in a way that this can be deployed to s3/cloudfront
31 lines (30 loc) • 1.07 kB
JavaScript
(function () {
'use strict';
angular.module('clientApp').directive('passMatch', directive);
directive.$inject = ['util'];
function directive(util){
return{
restrict: 'A',
require: 'ngModel',
scope: {
"secondPassword":"="
},
link: function(scope, element, attr, ngModel){
var checkPass2 = function (input) {
if (typeof scope.secondPassword !== 'undefined') {
if (input === scope.secondPassword) {
ngModel.$setValidity('passmatch', true);
} else {
ngModel.$setValidity('passmatch', false);
}
} else {
ngModel.$setValidity('passmatch', true);
}
return input
};
ngModel.$formatters.unshift(checkPass2);
ngModel.$parsers.unshift(checkPass2);
}
};
};
})();