Files
meanTorrent/modules/users/client/directives/password-verify.client.directive.js
Marek Grzybek d14d5130af feat(config): Deprecate JSHint in favor of ESLint
Add basic ESLint setup extending well-known Airbnb code style.

Fixes #1072, #1097
2016-03-15 19:11:12 +01:00

38 lines
821 B
JavaScript

(function () {
'use strict';
angular
.module('users')
.directive('passwordVerify', passwordVerify);
function passwordVerify() {
var directive = {
require: 'ngModel',
scope: {
passwordVerify: '='
},
link: link
};
return directive;
function link(scope, element, attrs, ngModel) {
var status = true;
scope.$watch(function () {
var combined;
if (scope.passwordVerify || ngModel) {
combined = scope.passwordVerify + '_' + ngModel;
}
return combined;
}, function (value) {
if (value) {
ngModel.$validators.passwordVerify = function (password) {
var origin = scope.passwordVerify;
return (origin === password);
};
}
});
}
}
}());