官方文档
https://angular.cn/api/forms/FormControlDirective
https://angular.cn/api/forms/FormControlName
Usage for FormControlDirective
name = new FromControl('');
<input type='text' [formControl]='name'>
Usage for FormControlName
profileForm = new FormGroup({
firstName: new FormControl(''),
lastName: new FormControl(''),
});
<input formControlName="firstName" placeholder="First name">
<input formControlName="lastName" placeholder="Last name">
为什么formControlName外面不加括号“[]”?