Angular2 If ngModel is used within a form tag, either the name attribute must be set or the form

前端 未结 14 2251
借酒劲吻你
借酒劲吻你 2020-12-04 07:33

I am getting this error from Angular 2

core.umd.js:5995 EXCEPTION: Uncaught (in promise): Error: Error in app/model_exposure_currencies/model_exposure_cu

相关标签:
14条回答
  • 2020-12-04 08:14

    Both attributes are needed and also recheck all the form elements has "name" attribute. if you are using form submit concept, other wise just use div tag instead of form element.

    <input [(ngModel)]="firstname" name="something">
    
    0 讨论(0)
  • 2020-12-04 08:15

    You didn't mention the version you're using, but if you're using rc5 or rc6, that "old" style of form has been deprecated. Take a look at this for guidance on the "new" forms techniques: https://angular.io/docs/ts/latest/guide/forms.html

    0 讨论(0)
提交回复
热议问题