What is the best way of preventing hidden form fields being validated in AngularJS?
I initially missed the built-in ngRequired
directive. There is a required
tag as well, which confused me.
Now, we can use the same logic (which we used to hide the element) to set the ngRequired
false.
Here is an example practical usecase: I want to ask married people the number of children they have, but, if they are not married, simply hide the field about children.