<formname= "Mgform"Ng-app= "MYAPP"Ng-controller= "Validatectrl"novalidate><P>User name:<inputtype= "text"name= "User"Ng-model= "User"Required><spanstyle= "Color:red"Ng-show= "Myform.user. $dirty && myform.user $invalid"><spanNg-show= "Myform.user. $error. Required">User name is required</span></span></P><P>Mailbox:<inputtype= "Email"name= "Email"Ng-model= "Email"Required><spanstyle= "color:red;"Ng-show= "Mgform.email. $dirty && mgform.email $invalid"><spanNg-show=myform.email. $error. Required>The mailbox is a must</span><spanNg-show= "Myform.email. $error. Email">Illegal mailbox</span></P><inputtype= "Submit"ng-disabled= "Myform.user.&dirty&&myform.user. $invalid| | myform.email. $dirty && myform.email $invalid "></form><Script>varapp=Angular.module ("myApp", []); App.controller ("Validatectrl",function($scope) {$scope. User="John Doe"; $scope. Eamil="[email protected]";});</Script>
* The font is displayed in red when the user name is $dirty and ¥invalid
$dirty: Form has a record $valid: The form field content is legal
$invalid: The contents of the form are illegal. $pristine: The form does not fill in records
Address: Original
Angular JS Input Verification