InterviewSolution
| 1. |
Form Validation |
|
Answer» Form Validation Required FieldHere we will use HTML5 attribute required to specify that input field must have some values. As below example:- ![]() Here we use HTML5 type email to specify that the value must be an email. And below is the example:- ![]() Now we read most important aspects in form state and input state Form State and Input StateAngularJS 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
|
|