mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-08 19:50:05 +01:00
27 lines
543 B
JavaScript
27 lines
543 B
JavaScript
(function() {
|
|
|
|
'use strict';
|
|
|
|
angular
|
|
.module('harbor.validator')
|
|
.directive('projectName', projectName);
|
|
|
|
projectName.$inject = ['PROJECT_REGEXP']
|
|
|
|
function projectName(PROJECT_REGEXP) {
|
|
var directive = {
|
|
'require': 'ngModel',
|
|
'link': link
|
|
};
|
|
return directive;
|
|
|
|
function link(scope, element, attrs, ctrl) {
|
|
ctrl.$validators.projectName = validator;
|
|
|
|
function validator(modelValue, viewValue) {
|
|
return PROJECT_REGEXP.test(modelValue);
|
|
}
|
|
}
|
|
}
|
|
|
|
})(); |