59334: edit item metadata finished

This commit is contained in:
lotte
2019-02-13 11:39:32 +01:00
parent 714811dc07
commit 7eec961fa7
14 changed files with 233 additions and 98 deletions

View File

@@ -1,7 +1,11 @@
import { AbstractControl, ValidatorFn } from '@angular/forms';
/**
* Returns a validator function to check if the control's value is in a given list
* @param list The list to look in
*/
export function inListValidator(list: string[]): ValidatorFn {
return (control: AbstractControl): {[key: string]: any} | null => {
const contains = list.indexOf(control.value) > 0;
const contains = list.indexOf(control.value) > -1;
return contains ? null : {inList: {value: control.value}} };
}