Last active
December 28, 2017 17:29
-
-
Save brachi-wernick/d6c162fd3f17d5d09c238250948209bc to your computer and use it in GitHub Desktop.
form with require if conditional validator
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
<h3>My children </h3> | |
<div class="form-check"> | |
<label class="form-check-label"> | |
<input class="form-check-input" type="checkbox" [(ngModel)]="hasChildren" name="hasChildren"> I do not have any children | |
</label> | |
</div> | |
<div class="form-group"> | |
<label>Name</label> | |
<input type="text" class="form-control" name="child1Name" | |
[(ngModel)]="child1Name" | |
[requiredIf]="!hasChildren" > | |
</div> | |
<div class="form-group"> | |
<label>birth Date</label> | |
<input type="date" class="form-control" name="child1Birthdate" | |
[(ngModel)]="child1Birthdate" | |
[requiredIf]="!!child1Name"> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment