[英]Show hexadecimal color in angularjs ui-select
我有一個ui-select,其中一個名為color的屬性是十六進制的,是否可以使用角度js來顯示該顏色?
<div class="form-group container-fluid">
<label class="col-md-2 control-label">Categoría:</label>
<div class="col-md-10">
<ui-select ng-model="activity.category" theme="bootstrap" title="Selecciona una categoría">
<ui-select-match placeholder="Selecciona una categoría">
{{ $select.selected.name }}
</ui-select-match>
<ui-select-choices repeat="category in categories | filter: $select.search">
{{ category.name + category.color}}
</ui-select-choices>
</ui-select>
</div>
</div>
這個怎么樣? 未經測試
<ui-select-choices repeat="category in categories | filter: $select.search> {{ category.name }} <button style="background-color:{{category.color}}"></button> </ui-select-choices>
當然,您可以使用任何<div>
,但此示例中的按鈕很簡單。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.