You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by an...@apache.org on 2019/06/11 10:57:21 UTC
[incubator-dlab] 02/05: [DLAB-743]: moved group-name-validarion
into general
This is an automated email from the ASF dual-hosted git repository.
ankovalyshyn pushed a commit to branch DLAB-743_wizard
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit 584ef57ef23e95994b401c65672a0006a219b3a0
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Mon Jun 10 17:20:22 2019 +0300
[DLAB-743]: moved group-name-validarion into general
---
.../directives/group-name-validarion.directive.ts | 37 ++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/directives/group-name-validarion.directive.ts b/services/self-service/src/main/resources/webapp/src/app/core/directives/group-name-validarion.directive.ts
new file mode 100644
index 0000000..e3f7207
--- /dev/null
+++ b/services/self-service/src/main/resources/webapp/src/app/core/directives/group-name-validarion.directive.ts
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { Directive, forwardRef, Input } from '@angular/core';
+import { AbstractControl, NG_VALIDATORS, Validator } from '@angular/forms';
+
+@Directive({
+ selector: '[validator][ngModel],[group-dir][ngFormControl]',
+ providers: [{
+ multi: true,
+ provide: NG_VALIDATORS,
+ useExisting: forwardRef(() => GroupNameValidationDirective)
+ }]
+})
+export class GroupNameValidationDirective implements Validator {
+ @Input() validator: Function;
+
+ validate(control: AbstractControl): { [key: string]: any; } {
+ return this.validator(control);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org