I have a ui-select and I need to show a color in a html span tag, I use ng-style to enter the color, in ng-select-choices it works, but in ui-select-match it does not work
<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 }}
<span style="width: 10px;
height: 10px;
border-radius: 50%;
display: inline-block"
ng-style="{'background-color': '{{$select.selected.color}}'}">
</span>
</ui-select-match>
<ui-select-choices repeat="category in categories | filter: $select.search">
{{ category.name }}
<span style="width: 10px; height: 10px;
border-radius: 50%; display: inline-block"
ng-style="{'background-color': '{{category.color}}'}">
</span>
</ui-select-choices>
</ui-select>
</div>
</div>
Why does not it work? Is there any way I can make it work?
Remove the double curly bracket
{{ }}interpolation from the expression:There is no guarantee that it works for every directive, because interpolation itself is a directive. If another directive accesses attribute data before interpolation has run, it will get the raw interpolation markup and not data.
For more information, see