Form validation normally used to occur at the server, after the client had entered all the necessary data and then pressed the Submit button.
AngularJS offers client-side form validation.
AngularJS monitors the state of the form and input fields (input, textarea, select), and lets you notify the user about the current state.AngularJS also holds information about whether they have been touched, or modified, or not.
Why validation required?
Form validation is required to prevent web form abuse by malicious users. Improper validation of form data is one of the main causes of security vulnerabilities.
- Name is required
- Username is not required, minimum length 3, maximum length 8
- Email is not required, but has to be a valid email
- Form submit is disabled if the form isn’t valid
- Show a required or invalid email error
- Alert awesome if submitted correctly
Angular provides properties on forms that help us validate them. They give us various information about a form or its inputs and are applied to a form and inputs.
|$valid||ng-valid||Boolean Tells whether an item is currently valid based on the rules you placed.|
Angular also provides classes on the form and its inputs so that you can style each state accordingly.
Accessing Angular Form Properties
- To access the form:
<form name>.<angular property>
To access an input:
<form name>.<input name>.<angular property>
Tririd offers service web application using Angular JS to their clients globally. Our structured Project management strategies, Eminent quality standards and Precise time management help our clients in being an edge in front of their rivals.
We provide training in Angular JS to the students of Computer stream at Ahmedabad. Our expert faculty motivate the students to develop their coding skill.
For more information about Angular JS at Tririd.
Call us @ 8980010210
Visit us @ http://www.tririd.com/technology/