aboutsummaryrefslogtreecommitdiffstats
path: root/src/angular/form-elements/validation/validators/base.validator.component.ts
blob: 3d751afe12fbbb822fa5f861fb088f36276c5189 (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, ContentChildren, EventEmitter, Output, QueryList, SimpleChanges, HostBinding } from "@angular/core";
import { IValidator } from './validator.interface';
import template from "./base.validator.component.html";

@Component({
    selector: 'sdc-validator',
    template: template
})
export abstract class ValidatorComponent {

    @Input() public message: any;
    @Input() public disabled: boolean;
    @HostBinding('class') classes;

    protected isValid: boolean;

    constructor() {
        this.disabled = false;
        this.isValid = true;
        this.classes = 'sdc-validator sdc-label__error';
    }

    public abstract validate(value: any): boolean;

}