mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-12 12:33:07 +00:00
59334: added validation
This commit is contained in:
7
src/app/shared/utils/validator.functions.ts
Normal file
7
src/app/shared/utils/validator.functions.ts
Normal 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}} };
|
||||
}
|
Reference in New Issue
Block a user