如何在ui-select-choices重复属性

时间:2016-01-15 07:48:28

标签: angularjs ui-select

在使用ui-select之前,我使用了简单的<select>标记,而我在那里

ng-options="item as (item.name || 'custom name') | htmlToPlainText  for item in items"

现在我开始使用ui-select,我想在<ui-select-choices> repeat属性中使用相同的内容,但它不起作用的示例:

    <ui-select-choices repeat="item as (item.name || 'custom name') | htmlToPlainText for item in items"> 
    ... 
    </ui-select-choices>

我收到错误

Error: [ui.select:iexp] http://errors.angularjs.org/1.3.9/ui.select/iexp?p0=Expected%20expressionNaNn%form%of%20'_item_%in%_collection_%5B%20track%20by%_id_%5D'%20but%20got%20'%7B0%7D'.&p1=item%20as%20(item.name || 'custom name')%for%item%in%20items

ui-select库是否可以支持或不支持?

1 个答案:

答案 0 :(得分:0)

你可以这样写:

<ui-select-choices repeat="item in items"> 
    {{(item.name || 'custom name') | htmlToPlainText}}
</ui-select-choices>