簡體   English   中英

在angularjs ui-select中顯示十六進制顏色

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM