From 95630fee6739511ae665d1fb9f30e3e9ea6403e0 Mon Sep 17 00:00:00 2001 From: "kunal.patel" Date: Mon, 30 Oct 2017 16:30:35 +1100 Subject: [PATCH] add null check --- src/less-than-equal/validator.ts | 1 + src/less-than/validator.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/less-than-equal/validator.ts b/src/less-than-equal/validator.ts index 0e8b50d..b540089 100644 --- a/src/less-than-equal/validator.ts +++ b/src/less-than-equal/validator.ts @@ -4,6 +4,7 @@ import { isPresent } from '../util/lang'; export const lte = (lte: number): ValidatorFn => { return (control: AbstractControl): {[key: string]: boolean} => { + if (!lte) return null; if (!isPresent(lte)) return null; if (isPresent(Validators.required(control))) return null; diff --git a/src/less-than/validator.ts b/src/less-than/validator.ts index 7a295b1..c153cae 100644 --- a/src/less-than/validator.ts +++ b/src/less-than/validator.ts @@ -4,6 +4,7 @@ import { isPresent } from '../util/lang'; export const lt = (lt: number): ValidatorFn => { return (control: AbstractControl): {[key: string]: boolean} => { + if (!lt) return null; if (!isPresent(lt)) return null; if (isPresent(Validators.required(control))) return null;