Angular: 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.

在Angular中,动态生成的Html控件,如果没有name属性并且在ts中要操作Model的内容。就会引发如题的错误。

解决方案两个:

  1. 加上name的属性
  2. 设置ngModelOptions

     
 
 
原文地址:https://www.cnblogs.com/qingchengcoding/p/10878779.html