0
我有许多项目的下拉列表,如果我点击选择来显示列表,我想突出显示不同颜色的列表中的一些项目。AngularJS select,设置下拉菜单项的背景颜色
预期行为:当我们点击选择(在选择任何项目之前)时,如果标签Obligatory为真,如何让列表中的项目“Section3”在黄色(背景部分)中突出显示?
$scope.globalSections = [
{name: 'Section1', department: 'Summary'},
{name: 'Section2', department: 'Group1'},
{name: 'Section3', department: 'Group1', obligatory: true},
{name: 'Section4', department: 'Group2'},
{name: 'Section5', department: 'Group2'}
];
$scope.selectedSection = $scope.globalSections[0]; // Summary
<select ng-model="selectedSection" ng-options="section.name group by section.department for section in globalSections">
在看看:HTTP://计算器.com/questions/15264051/how-to-use-ng-options –
是的代码看起来不错,但[Plnkr建议](http://plnkr.co/edit/) rbc4GWBffi4eFYhbvS6u?p =预览)在Chrome或Safari中似乎不起作用(显示颜色)。 – MatMath