10 lines
454 B
TypeScript
10 lines
454 B
TypeScript
import { ValidatorFn, AbstractControl } from '@angular/forms';
|
|
import { BaseErrorModel } from 'app/shared/components/criteria/models/errormodel/BaseErrorModel';
|
|
|
|
export function BackendErrorValidator(errorModel: BaseErrorModel, propertyName: string): ValidatorFn {
|
|
return (control: AbstractControl): { [key: string]: any } => {
|
|
const error: string = (<any>errorModel)[propertyName];
|
|
return error ? { 'backendError': { value: error } } : null;
|
|
};
|
|
}
|