Snippet of HTML code:
<li class="dropdownfilter" *ngIf="this.arr.inclues('Male')" (click)="getValueGender('Male',1,)" [(ngModel)]="M"><a>Male</a></li>
I encountered the following error:
ERROR Error: No value accessor for form control with unspecified name attribute
To resolve this issue, I added a name attribute:
<li class="dropdownfilter" name="gendermale" *ngIf="this.arr.inclues('Male')" (click)="getValueGender('Male',1,)" [(ngModel)]="M"><a>Male</a></li>
Now I am facing a new exception:
ERROR Error: No value accessor for form control with name: 'gendermale'
This error is appearing in multiple sections of my code.
<div class="col-sm-8 col-xs-8 contact">
<input id="passphn{{bus.busServiceId}}" (keyup)="onKeyPress($event)" class="form-control contact-number" type="text" [(ngModel)]="contactNumber" name="contact-number" placeholder="Phone" required pattern="(?<!\d)\d{10}(?!\d)" minlength="10" maxlength="10" />
<div class="shake-tooltip-web-mobile" *ngIf="webMobileError != ''">{{webMobileError}}</div> <!-- Facing the same exception here -->
</div>
<div class="panel-body" *ngIf="dropingView == 'show'"> <!-- Here too -->