I want to add a validator to my FormControl that validates the form if a boolean is false.
There is requiredTrue but I need the opposite. Is there a validator for requiredFalse?
this.myForm.controls.existObjectsWithThisStudyIdControl.addValidators(Validators.requiredFalse);Another option is to rename my variable which is
existObjectsWithThisStudyIdtononeObjectsExistWithThisStudyIdand then use requiredTrue. But it feels like a bad practice for naming.
You can conditionally add the validator. Ex.
You can then set your validator on init, or on any event that that changes your boolean value: