If ngForm is used, all the input fields which have [(ngModel)]=""
must have an attribute name with a value.
<input [(ngModel)]="firstname" name="something">
Standalone
By setting [ngModelOptions]="{standalone: true}"
one tells Angular something like, ignore the form and/or ngForm
, just bind it to firstname
variable please.
However, if form
-tag was used by mistake (like in my case sometimes), changing form
to div
is another option (but only if your styles don’t need form
-tag).