响应式表单ReactiveFormModule
<input type="text" [formControl]="favoriteColorControl">
export class FavoriteColorComponent {
favoriteColorControl = new FormControl('');
}
模板驱动表单FormModule
<input type="text" [(ngModel)]="favoriteColor">
export class FavoriteColorComponent {
favoriteColor = '';
}
两种表单公用
angular中的api接口