Hi Guest 1 HomePage 1 Jobs 1 WalkIn 1Articles  

 :) Latest Topic
Numbers And Strings
Objects And Array
AngularJS VS JavaScript
Controllers in Files
Load the Library
AngularJS Directives
Repeating Directive
AngularJS Facts
Create Directives
Restrict Directive
Custom Filter
AngularJS Services
AngularJS Service 2
AngularJS Tables
Select Option
Select Option 2
AngularJS Forms
Form Validation
Validation CSS
Validation Example
AngularJS API
AngularJS $http
AngularJS Database
AngularJS HTML DOM
AngularJS Events
Custom Validation
AngularJS Tutorial
AngularJS Introduction
Angular init Directive
AngularJS Expressions 1
AngularJS Applications
AngularJS Expressions 2
Angular CSS Properties
AngularJS JSON
AngularJS Modules
Controller Basic
Add a Directive
Model Directive
Validate Inputs
CSS Classes
Data Binding
AngularJS Controller
AngularJS Scope
Root of Scope
AngularJS Filters
 


  

 
Form Validation
Question Posted on 23 Apr 2020

Home >> Tutorial >> AngularJS >> Form Validation


Form Validation
From AngularJS we can validate input data by user. Its offers client side form validation. From AngularJS monitors state of form and input fields like input, textarea and select. And helps you to get the current state to the user. From AngularJS will holds information about if they have been touched or modified or not. We can use standard HTML5 attributes to validate user input. We can also make custimzation validation.

As we all know the only client side validation is not enough to fully secure user input we will also need server side validation.

Now below have some validation with examples:-

Required Field


Here we will use HTML5 attribute required to specify that input field must have some values. As below example:-


AngularJS Required Field

E-mail


Here we use HTML5 type email to specify that the value must be an email. And below is the example:-

AngularJS Email Validation
Now we read most important aspects in form state and input state

Form State and Input State



AngularJS constantly update the state of both the form and Input fields.

Below are different Input fields have the following states:-
(1)$untouched This will happen when field has not been touched yet
(2)$touched This will happen when field has been touched
(3)$pristine This will happen when field has not been modified yet
(4)$dirty This will happen when field has been modified
(5)$invalid This will happen when field content is not valid
(6)$valid This will happen when field content is valid

All of above properties of input field either true or false.

Below are different Forms states:-
(1)$pristine When No fields have been modified yet
(2)$dirty when One or more have been modified
(3)$invalid When form content is not valid
(4)$valid when form content is valid
(5)$submitted when form is submitted

All of above properties either true or false.

From above properties we have use one touched example which will helps you to understand


AngularJS Validation Touched





Other Important Questions
Numbers And Strings
Objects And Array
AngularJS VS JavaScript
Controllers in Files
Load the Library







 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |