I'm getting this suggestion in the developer-console when using angular template-driven form and not writing 'name' attribute but, I'm using [(ngModel)] with the input field.
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}">
If I'm using 'name' attribute or [ngModelOptions]="{standalone: true}" then working fine.
But I'm not sure why that suggestion is occuring?
If i could see your whole form code,i could explain more clearly.
Assuming you are using [formGroup] directive,then
This error could come if you are mentioning formControlName for only some fields in the form and not for all. Angular expects us to use formContorl in the reactive form and you are using ngModel . Since it cannot get an instance of formControl, its asking you to mention [ngModelOptions]="{standalone: true}". You can achieve same thing with formControl without ngModel binding for fields also.
https://angular.io/guide/reactive-forms
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With