Below is the selection box
<select ng-model="colour" ng-options="c.id as c.name for c in colors" ng-init="colour=2">
<option value="">--Select Colour--</option>
</select>
and the following code in the controller
$scope.colors = [
{id: 1, name: 'black', shade: 'dark'},
{id: 2, name: 'white', shade: 'light'},
{id: 3, name: 'red', shade: 'dark'},
{id: 4, name: 'blue', shade: 'dark'},
{id: 5, name: 'yellow', shade: 'light'}
];
In this selection, only the color name is displayed, and my requirement is to display the name and shadow in the option text. I tried, but no luck and did not find a helpful message to do this.
Does anyone have an idea to display both the name and the hue in the text of the selection option (ed., black dark).
source
share