Last active
June 18, 2019 13:42
-
-
Save ganqqwerty/8188aef81a957508d18aee1584639705 to your computer and use it in GitHub Desktop.
This file contains 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
function emailConditionallyRequiredValidator(formGroup: FormGroup) { | |
if (formGroup.value.myCheckbox) { | |
return Validators.required(formGroup.get('myEmailField')) ? { | |
myEmailFieldConditionallyRequired: true, | |
} : null; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment