blob: 0ec0e681fb7b1bf1304151b9a32a2f6b36f79805 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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-custom-validator',
template: template
})
export class CustomValidatorComponent extends ValidatorComponent implements IValidator {
@Input() public callback: (...args) => boolean;
constructor() {
super();
}
public validate(value: any): boolean {
this.isValid = this.callback(value);
return this.isValid;
}
}
|