I am using Angular 2 (TypeScript).
I have a class which looks like this:
class Device{
id:string;
label:string;
}
I want to show device label in dropdown list, but in onChange() I want to get device ID. What can I do? Thank you!
<select #device (change)="onChange($event, device.value)">
<option *ng-for="#i of devices.label">{{i}}</option>
</select>
onChange($event, deviceValue) {
console.log(deviceValue);
// Right now deviceValue is device label, however I want to get device ID.
}