Sujeet Raman

Sujeet Raman

  • 864
  • 927
  • 352.9k

How to get drop down object in drop down click event?

May 26 2018 2:27 AM
Hi i have a dropdown having values id and value.On the click event i need to use both id and value .now i am passing id only in ngmodel.how can i pass the object in ngmodel..so i can use in ts like object.id,and object.value
 
please help 
 
this s my dropdown
 
<select class="styled-select" [(ngModel)]="id" (change)="onSelectYear($event.target.value)">
<option [ngValue]="select" disabled [selected]="true">--Select Model Year--</option>
<option *ngFor="let code of year " value={{code.id}}>{{code.value}}</option>
</select>
 
 
in ts file i shud get like
 
onSelectYear(obj: any) { 
obj.id=
obj.value= 
}
 

Answers (1)