首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在ui-select -select重复属性中添加AngularJS ui-select表达式

如何在ui-select -select重复属性中添加AngularJS ui-select表达式
EN

Stack Overflow用户
提问于 2016-01-15 15:48:28
回答 1查看 454关注 0票数 1

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

代码语言:javascript
复制
ng-options="item as (item.name || 'custom name') | htmlToPlainText  for item in items"

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

代码语言:javascript
复制
    <ui-select-choices repeat="item as (item.name || 'custom name') | htmlToPlainText for item in items"> 
    ... 
    </ui-select-choices>

我收到的错误信息如下

代码语言:javascript
复制
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库不支持它?

EN

回答 1

Stack Overflow用户

发布于 2016-01-15 16:06:32

你可以这样写:

代码语言:javascript
复制
<ui-select-choices repeat="item in items"> 
    {{(item.name || 'custom name') | htmlToPlainText}}
</ui-select-choices>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34806414

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档