Reputation: 173
I have a data source which looks like this
$scope.NameList = [
{ id:1, name:'Thomas S.', short:'TS' },
{ id:2, name:'Paul F.', short:'PF' },
{ id:3, name:'Kate M.', short:'KM' }
]
I want my DropDown to display the property name
as options, bind the id
property to a model and display the the property short
of the selected item. Is there a way to achieve that with ng-options
?
Upvotes: 3
Views: 1136
Reputation: 3280
No, because it uses the HTML select
component that is not able to distinguish between the displayed text in the dropdown and the shown value.
However you could build an own directive for implementing a similar behaviour, for example with a bootstrap dropdown menu.
Upvotes: 1