mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-23 23:59:17 +01:00
38 lines
821 B
JavaScript
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);
|
|
};
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}());
|