Last active
June 11, 2018 19:39
-
-
Save brachi-wernick/c449093d7842562143818c6179b50d00 to your computer and use it in GitHub Desktop.
requiredIfValidatorFnMutableInput
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function requiredIf(requiredIf:{value:boolean}): ValidatorFn { | |
return (control: AbstractControl): ValidationErrors | null => { | |
let value = control.value; | |
if ((value == null || value == undefined || value == "") && requiredIf.value) { | |
return { | |
requiredIf: {condition:requiredIf.value} | |
}; | |
} | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment