在使用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库不支持它?
发布于 2016-01-15 16:06:32
你可以这样写:
<ui-select-choices repeat="item in items">
{{(item.name || 'custom name') | htmlToPlainText}}
</ui-select-choices>https://stackoverflow.com/questions/34806414
复制相似问题