<div class="input-group">
<span class="input-group-addon start"
ng-bind="type.refs['r1'].title"></span>
<select ng-model="ligth_r1">
<option value="" disabled selected>Select a Ligth</option>
<option ng-attr-value="ligth" ng-repeat="ligth in calculator.ligths">{{ligth.name}} <span ng-show="ligth.recommended" class="label label-primary">Recommended</span></option>
</select>
</div>
我的目标是使用带有值&#34; Recomended&#34;的引导标签标记其中一个选项。
但&#34; Recomended&#34;看起来是白色的,而不是像我预期的那样蓝色。
我做错了什么?
答案 0 :(得分:2)
最好的办法是使用here中的select2
组件。它支持select中的模板,例如:
function format(state) {
if (!state.id) return state.text; // optgroup
return "<img class='flag' src='images/flags/" + state.id.toLowerCase() + ".png'/>" + state.text;
}
$("#e4").select2({
formatResult: format,
formatSelection: format,
escapeMarkup: function(m) { return m; }
});
HTML:
<select>
<option value="0" data-foo="bar">option one</option>
...