Template driven form (experimental section)

# Template-driven form validation (template-driven form validation) realization of ideas

1. 引入 FormsModule

2. Application NgForm and ngModel (class associated attributes)

3. Verify

4. prompt

5. Submit (the Submit)

# Implementation of knowledge
In the login.component.ts
<Form # f = "ngForm" class = "login-form"> // create the template reference variable

Data binding between the two-way data binding, template and model class

Create a model (model is a class)

Examples of the three methods #

1. Declare that is instantiated

Examples of the 2.constructor

When 3.init, instantiation

email? .v logic for determining, when the current presence of the object surface, (not null), the latter property for fishes operation.
 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/aiyamoer/p/10947916.html