59334: added validation

This commit is contained in:
lotte
2019-02-12 12:48:32 +01:00
parent 45c699e4d8
commit 714811dc07
17 changed files with 226 additions and 52 deletions

View File

@@ -0,0 +1,7 @@
import { AbstractControl, ValidatorFn } from '@angular/forms';
export function inListValidator(list: string[]): ValidatorFn {
return (control: AbstractControl): {[key: string]: any} | null => {
const contains = list.indexOf(control.value) > 0;
return contains ? null : {inList: {value: control.value}} };
}