在 ui-select 中使用 title 属性
Using title attribute in ui-select
我遇到 select 的文本太长,不适合列表宽度或 selected 字段。所以至少我需要在鼠标悬停时使用 span 中的 title 属性显示完整名称。
我试过这个:
<ui-select ng-model="f.fieldb.value">
<ui-select-match>
<span ng-bind="$select.selected.nm" title="$select.selected.nm"></span>
</ui-select-match>
<ui-select-choices repeat="item in (fieldsList | filter: $select.search)">
<span ng-bind="item.nm" title="f.item.nm"></span>
</ui-select-choices>
</ui-select>
但我明白了(请注意,鼠标指针旁边显示的文本不正确):
是否可以得到正确的名字?
您需要像这样将它们作为表达式求值:
title="{{f.item.nm}}"
您当前将标题设置为字符串 "f.item.nm",而不是项目 object
中保存的 nm 值
我遇到 select 的文本太长,不适合列表宽度或 selected 字段。所以至少我需要在鼠标悬停时使用 span 中的 title 属性显示完整名称。
我试过这个:
<ui-select ng-model="f.fieldb.value">
<ui-select-match>
<span ng-bind="$select.selected.nm" title="$select.selected.nm"></span>
</ui-select-match>
<ui-select-choices repeat="item in (fieldsList | filter: $select.search)">
<span ng-bind="item.nm" title="f.item.nm"></span>
</ui-select-choices>
</ui-select>
但我明白了(请注意,鼠标指针旁边显示的文本不正确):
是否可以得到正确的名字?
您需要像这样将它们作为表达式求值:
title="{{f.item.nm}}"
您当前将标题设置为字符串 "f.item.nm",而不是项目 object
中保存的 nm 值