# AngularJS Input Validation
* * *
AngularJS forms and controls can validate input data.
* * *
## Input Validation
In the previous chapters, you have learned about AngularJS forms and controls.
AngularJS forms and controls can provide validation functionality and warn users of invalid input data.
|  | Client-side validation cannot ensure the security of user input data, so server-side data validation is also necessary. |
| --- |
* * *
## Application Code
Validation Example
Username:
Usernameis required.
Email:
Emailis required.
Invalid email.
var app = angular.module('myApp', []);
app.controller('validateCtrl', function($scope) {
$scope.user = 'John Doe';
$scope.email = 'john.doe@gmail.com';
});
[Try it Β»](#)
|  | The HTML form attribute **novalidate** is used to disable the browser's default validation. |
| --- |
* * *
## Example Explanation
The AngularJS **ng-model** directive is used to bind input elements to the model.
The model object has two properties: **user** and **email**.
We used the **ng-show** directive, which displays the color:red only when the email's **$dirty** or **$invalid** is true.
| Property | Description |
| --- | --- |
| $dirty | The form has been filled |
| $valid | The field content is valid |
| $invalid | The field content is invalid |
| $pristine | The form has not been filled |