I want to obtain the complete object of the element that I currently have selected in my dropdown. Currently I get the selected value and this is fine for me! but additional I want to obtain the complete object. How can I do it?
<select [(ngModel)]="user" (change)="fn_consolidadoUsuario()" mdbInput >
<option *ngFor="let item of aUser" [value]="item.iduser">{{item.name}}
</option>
user:any
aUser:
[
{
"iduser":1, "name":"joe"
},
{
"iduser":1, "name":"berta"
},
{
"iduser":1, "name":"francisco"
}
]
this.user=1; //value by default
fn_consolidadoUsuario(){
console.log(this.user)// 1
//also I need the actual item {"iduser":1, "name":"joe"}
}