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. Example 1: <input [(ngModel)]="person.firstName" name="first">

Example 1: ERROR Error: 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.

<!--Add the 'name' attribute-->
<input [(ngModel)]="note" name="something">

<!--Or-->
<input [(ngModel)]="note" [ngModelOptions]="{standalone: true}">

Example 2: company-list.component.html:251 ERROR Error: 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.

<div class="p-field p-col-12 p-md-4 pad-t-10" >
                    <form autocomplete="off">
                            <label class="ui-g-6">Area<span style="color: red;">*</span></label>
                            <!-- [value]="companyAreaFor" -->
                        <p-dropdown [options]="areaAndCityList" [ngModelOptions]="{standalone: true}" editable="true" [(ngModel)]="selectArea" [disabled]="inactive" [placeholder]="selectArea" filter="true" optionLabel="postOffice"
                        (onChange)="onchangeArea($event)"
                            ></p-dropdown>
                        
                </form>

                </div>

Tags:

Misc Example