[英]Adding style to ng-option on condition with AngularJs
我使用以下代碼渲染選項,其中選項使用ng-options呈現:
<select ng-options="cat.id as cat.name for cat in categories">
<option value="" selected="selected">Default Option...</option>
</select>
我需要將CSS樣式選項(即font-weight:bold)添加到具有特定ID的選項中。 有什么建議嗎?
如果您需要設置樣式,請考慮使用
<option
ng-repeat="cat in categories"
ng-value="{{ cat.id }}"
ng-bind="cat.name"
ng-style="cat.style"></option>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.