报错:
ERROR Error: NG01352: If ngModel is used within a form tag, either the name attribute must be set or the form
control must be defined as 'standalone' in ngModelOptions.
Example 1: <input [(ngModel)]="person.firstName" name="first">
Example 2: <input [(ngModel)]="person.firstName" [ngModelOptions]="{standalone: true}">
解决办法
如果在表单标签中使用 ngModel,则必须设置 name 属性或表单控件必须在 ngModelOptions 中定义为“独立”!!!
标签中加上
[ngModelOptions]="{ standalone: true }"