Is it possible to set a complex label in a comprehension expression in Angular?
I've searched everywhere for a solution, but I can't seem to find one. The workaround I found involves pre-populating the 'as' label attribute with the desired string before using it in the comprehension expression, which is not ideal.
For instance, consider this object:
$scope.projects = [{
"description": "Asset Management",
"code": "ASSET",
"fieldName": "Asset Evaluation Level"
},
{
"description": "Checklist",
"code": "CHECK",
"fieldName": "Checklist Scores"
},
{
"description": "IT Support",
"code": "IT",
"fieldName": "IT Support Ticket Number"
}]
There's a select element with ng-options:
<select ng-model="jiraProject" class="form-control" ng-options="option as option.description for option in projects"></select>
I want the options to appear in the dropdown like this:
"Asset Management (ASSET)", "Checklist (CHECK)", "IT Support (IT)"
Is there a syntax that would allow me to achieve this, such as:
option as {options.description (option.code)} for option in projects
Thank you for any assistance!