aboutsummaryrefslogtreecommitdiffstats
path: root/src/angular/form-elements/validation/validators/required.validator.component.ts
blob: 7eee932493454114e59287d51f0b7d08cd08687f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;
    }

}