Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature suggestion: Conditional validation #14

Closed
idreeshaddad opened this issue Aug 7, 2014 · 2 comments
Closed

Feature suggestion: Conditional validation #14

idreeshaddad opened this issue Aug 7, 2014 · 2 comments

Comments

@idreeshaddad
Copy link
Contributor

Like only when you the check box is selected, the controls in the block are validated.

@idreeshaddad
Copy link
Contributor Author

Actually ng-if can be used to add and remove the control to the DOM; so the control will be validated only if it is present in the DOM.

For further information refer to: This article

@idreeshaddad
Copy link
Contributor Author

Alternatively, and if you don't want to remove the control from the DOM with ng-if; you can use ng-required:
E.g.: Validate a text box only if a check box is selected:

<input type="checkbox" ng-model="needed"/>
<input type="text" ng-model="emailAddress" ng-required="needed"/> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant