Angular 2 ngModelChange select option, grab a specific property

Viewed 79721

I have a dropdown select form in angular 2.

Currently: When I select an option the option name gets passed into my onChange function as $event

Wanted: When I select an option I would like to pass workout.id into my onChange function.

How can I achieve that?

<select class="form-control" [ngModel]="selectedWorkout" (ngModelChange)="onChange($event)">
    <option *ngFor="#workout of workouts">{{workout.name}}</option>
</select>

Controller

onChange(value){
  alert(JSON.stringify(value));
}
2 Answers
Related