Complete the registration form with ANGULARJS

Source: Internet
Author: User

ng-init= "username = ' first '" Setting Initial display first field
ng-class= "{' Error ': Signupform.username. $invalid && signupform.username. $touched}" to verify that the form did not pass, Touched verify if it has been useful
Ng-if= ' signupform.username. $valid ' input legal-dry ...
Minlength= "4" minimum of four characters
Maxlength= "10" maximum of 10 characters

Ng-submit can only be used for form
Ng-disabled is used to make something unusable

Enter password and Confirm password Compare register a compare instruction


Angular.module (' MyApp ', []). directive (' compare ', function () {

var com ={};
Commands are applied to elements and attributes
Com.strict = "AE";
Com.scope = {
The previous character, @ corresponds to the string, = corresponding data,& corresponding function
Orgtext: ' =compare '
}
Com.require = ' Ngmodel ';
/*
*scope Domain, $scope
*ele Current Element
*attr Property
*control Ngmodel
*v user Input values
*/
Com.link = function (Scope,ele,attr,control) {
Control. $validators. Compare = function (v) {
Return v ==scope.orgtext;
}
Compared to the previous Orgtext
Scope. $watch (' Orgtext ', function () {
Start validation Once there is a change
Control. $validate ();
})
}
return COM;
})

Code Address: Https://github.com/fanpeiyao/angularForm.git

Complete the registration form with ANGULARJS

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.