Not sure how else to title this. I'm using ng-options to generate a drop down. The source array is of the following form:
[{
id:1,
name: 'Bob'
},
{
id:2,
name: 'Tom'
}...(etc)
]
my ng-options looks like this:
ng-options="item.name as item.name for item in myObj
which I need since the ng-model is to the name elsewhere. However, on the ng-change, I want to send (among other things) the item.id. But I can't figure out how to access that at that point. Not only is item.id undefined in the ng-change, even item is undefined at that point. But, I can't use it in the `ng-options since I need it to model to the name elsewhere.
How do I access item.id for use in the ng-change?
This should do the trick: