apollodec/Apollo/assets/js/directives/compare-to.js
saravanakumar_kandasami 7d72a0b91a updated code
2017-11-21 14:56:39 +05:30

22 lines
543 B
JavaScript

'use strict';
/**
* Password-check directive.
*/
app.directive('compareTo', function () {
return {
require: "ngModel",
scope: {
otherModelValue: "=compareTo"
},
link: function (scope, element, attributes, ngModel) {
ngModel.$validators.compareTo = function (modelValue) {
return modelValue == scope.otherModelValue;
};
scope.$watch("otherModelValue", function () {
ngModel.$validate();
});
}
};
});