aboutsummaryrefslogtreecommitdiffstats
path: root/src/angular/form-elements/validation/validators/required.validator.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/angular/form-elements/validation/validators/required.validator.component.ts')
-rw-r--r--src/angular/form-elements/validation/validators/required.validator.component.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/angular/form-elements/validation/validators/required.validator.component.ts b/src/angular/form-elements/validation/validators/required.validator.component.ts
new file mode 100644
index 0000000..7eee932
--- /dev/null
+++ b/src/angular/form-elements/validation/validators/required.validator.component.ts
@@ -0,0 +1,25 @@
+import { Input, Component } from "@angular/core";
+import { ValidatorComponent } from "./base.validator.component";
+import { IValidator } from './validator.interface';
+import template from "./base.validator.component.html";
+
+@Component({
+ selector: 'sdc-required-validator',
+ template: template
+})
+export class RequiredValidatorComponent extends ValidatorComponent implements IValidator {
+
+ constructor() {
+ super();
+ }
+
+ public validate(value: any): boolean {
+ if (value) {
+ this.isValid = true;
+ } else {
+ this.isValid = false;
+ }
+ return this.isValid;
+ }
+
+}