I have json with the following format.
When I select an option, I would like to pass the values (code & description values from json) to the component.
nameList= [
{
"code": "1",
"description": "abc"
},
{
"code": "123",
"description": "def"
},
{
"code": "100",
"description": "ijk"
}
]
HTML
<select [(ngModel)]="description" #category="ngModel" aria-required
(change)="getNameList()"> //want to send data.code value to component
<option style="display:none"></option>
<option *ngFor="let data of nameList"> {{data.description}}
</option>
</select>