天天看点

Angular form学习笔记

https://angular.io/start/start-forms

Angular里的form分成两部分:

the objects that live in the component to store and manage the form, and the visualization of the form that lives in the template.

位于Component里的objects, 用于store和管理form

以及template里的visualization部分。

the form model is the source of truth for the status of the form.

Angular’s FormBuilder service provides convenient methods for generating controls.

使用Angular的FormBuilder创建controls.

import { FormBuilder } from '@angular/forms';

1

The ReactiveFormsModule provides the FormBuilder service, which AppModule (in app.module.ts) already imports.

define the checkoutForm property to store the form mod

Angular form学习笔记
Angular form学习笔记
Angular form学习笔记
Angular form学习笔记

继续阅读