mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-12 12:33:07 +00:00
59334: edit item metadata finished
This commit is contained in:
@@ -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}} };
|
||||
}
|
||||
|
Reference in New Issue
Block a user