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