I am trying to auto populate an input field based on the selected value of a dropdown. The following is the code and it is not working. Please suggest.
<form [formGroup]="employeeForm" (ngSubmit)="OnSubmit()"> <mat-form-field appearance="outline"> <mat-label>Employee ID</mat-label> <input type="text" placeholder="Employee ID" required formControlName="employeeidControl" matInput [matAutocomplete]="auto1"> <mat-autocomplete #auto1="matAutocomplete"> <mat-option *ngFor="let employee of employees" [value]="employee.id"> {{ employee.id }} </mat-option> </mat-autocomplete> <mat-error> Employee ID is required </mat-error> </mat-form-field> <mat-form-field appearance="outline"> <mat-label>Employee Name</mat-label> <input type="text" matInput placeholder="Employee Name" value="{{employeeidControl.name}}" required formControlName="employeenameControl"> <mat-error> Employee Name is required </mat-error> </mat-form-field> </form>