I'm creating an optional part of a form. Once one of the two elements is selected (or text has been entered) the other is required but if there is no input for both these fields are not required. Can I accomplish this with ng-required? If not is there another way? Thanks for the help in advance!
apply ng-required if another element is selected
71 Views Asked by sanitycheck At
2
You can just do a
ng-requiredwith the other model as parameter:If the first input is filled in,
myFirstInputwill evaluate to truthy, so the second input will be required.See this jsfiddle