Charge min and max cap validatons on focus
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
|
||||
|
||||
export function minLessThanOrEqualMaxValidator(minKey: string, maxKey: string): ValidatorFn {
|
||||
return (group: AbstractControl): ValidationErrors | null => {
|
||||
const min = group.get(minKey)?.value;
|
||||
const max = group.get(maxKey)?.value;
|
||||
|
||||
if (min != null && max != null) {
|
||||
if (max * 1 < min * 1) {
|
||||
return { minGreaterThanMax: true };
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user