Currently, I am working on a reactive form that includes fields for first name, last name, and display name. The goal is for the display name to automatically populate with the concatenated values of the first and last name. However, as I am still learning, I have been struggling to identify the issue in my code. Any guidance or advice would be greatly appreciated. Thank you.
Below is the code I have so far:
<form [formGroup]="myForm" novalidate (ngSubmit)="save(myForm.value, myForm.valid)">
<div class="form-group">
<label for="">First Name</label>
<input type="text" class="form-control" formControlName="firstname" [(ngModel)]="firstname">
</div>
<div class="form-group">
<label for="">Last Name</label>
<input type="text" class="form-control" formControlName="lastname" [(ngModel)]="secondnamename">
</div>
<div class="form-group">
<label for="">Display Name</label>
<input type="text" class="form-control" formControlName="displayname" value='{{firstname}}{{lastname}}'>
</div>
<div class="margin-20">
<div>myForm details:-</div>
<pre>myForm value: <br>{{myForm.value | json}}</pre>
</div>
</form>
Gif: