Initial commit
This commit is contained in:
commit
880e39de2e
511 files changed
+38363
No files matched your search
@@ -0,0 +1,22 @@
|
||||
angular.module('portal.common.directives.compareTo', ['ui.router'])
|
||||
.directive('compareTo', function(){
|
||||
return {
|
||||
require: 'ngModel',
|
||||
scope: {
|
||||
otherModelValue: '=compareTo'
|
||||
},
|
||||
link: function(scope, element, attributes, ngModel) {
|
||||
|
||||
ngModel.$validators.compareTo = function(modelValue) {
|
||||
if ((modelValue === null || modelValue === undefined) && scope.otherModelValue === null) {
|
||||
return true;
|
||||
}
|
||||
return modelValue === scope.otherModelValue;
|
||||
};
|
||||
|
||||
scope.$watch('otherModelValue', function() {
|
||||
ngModel.$validate();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
Reference in new issue
Block a user