Here is the code snippet I have:
<select label="people" id="ppl" [(ngModel)]="Selectedppl" (ngModelChange)="onPplSelection($event.target.value)">
<option>select people</option>
<option *ngFor="let x of peopleList" [ngValue]="x">
{{x.name}}
</option>
I am dealing with a list of objects that contain properties such as name, address, and contact. My goal is to pass the entire object as a parameter to ngModelChange using ngValue.
Furthermore, once a specific person has been selected and saved, I would like the dropdown menu to display the name of the selected individual. Essentially, I want the default selected option in the dropdown to reflect the saved value.
It's important to note that I am not utilizing Reactiveforms in this scenario.