Angular JS Input Verification

Source: Internet
Author: User

<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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.