Code cleanup part #1: move all the services and directive JS code in the app.js file into its own files
This commit is contained in:
parent
3cae6609a7
commit
9b87999c1c
97 changed files with 7076 additions and 6870 deletions
16
static/js/directives/match.js
Normal file
16
static/js/directives/match.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Adds a 'match' attribute that ensures that a form field's value matches another field's
|
||||
* value.
|
||||
*/
|
||||
angular.module('quay').directive('match', function($parse) {
|
||||
return {
|
||||
require: 'ngModel',
|
||||
link: function(scope, elem, attrs, ctrl) {
|
||||
scope.$watch(function() {
|
||||
return $parse(attrs.match)(scope) === ctrl.$modelValue;
|
||||
}, function(currentValue) {
|
||||
ctrl.$setValidity('mismatch', currentValue);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
Reference in a new issue