Reputation: 53
I have array with object:
[ ... { id: 1, name: 'Value', desc: 'Test' } ... ]
How i can generate option by ng-options with text Value (Test)?
Value (Test)
Upvotes: 4
Views: 1326
Reputation: 48837
You could use:
<select ng-model="selectedOption" ng-options="o.id as o.name + ' (' + o.desc + ')' for o in options"> </select>
Demo
Upvotes: 7