Angular 2+ Error !!! “If ngModel is used within a form tag, either the name attribute must be set or the form”

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

Solution :

If ngForm is used, all the input fields which have [(ngModel)]=”” must have an attribute name with a value.

<input [(ngModel)]="firstname" name="something">

Laisser un commentaire