Angularjs Input Validation
Angularjs forms and controls can validate the data entered.
Input validation
In the previous chapters, you've learned about Angularjs forms and controls.
Angularjs forms and controls can provide validation and warn you about illegal data entered by users.
Note: client-side validation does not ensure that user input data is secure, so data validation on the server is also required.
Application code
Run Result:
Validating instances
User name:
Mailbox:
Note: HTML Form Properties Novalidate is used to disable browser default validation.
Instance resolution
The ANGULARJS ng-model directive is used to bind input elements into the model.
The model object has two properties: user and email.
We use the ng-show directive, color:red is displayed when the message is $dirty or $invalid.
Property |
Description |
$dirty |
Form has fill in the record |
$valid |
The contents of the field are legal |
$invalid |
The field contents are illegal |
$pristine |
The form does not fill in the record |
The above is the ANGULARJS input verification data collation, follow-up continue to add, hope to help students learn.