ui-select不重复
ui-select without ng-repeat
我需要向 ui-select
添加两个选项,而不是使用重复和数组,我认为如果将它们标记在 <ui-select-choices>
中,代码会更清晰(请参见下面的示例)。但它不起作用,如果这在某种程度上可能,有什么想法吗?
<ui-select ng-model="formula.value">
<ui-select-match>
<span ng-bind="$select.selected.name"></span>
</ui-select-match>
<ui-select-choices>
<span>AND</span>
<span>OR</span>
</ui-select-choices>
</ui-select>
这是不可能的,因为 ui-select-choices
需要 repeat
属性,如 the source 中的第 21 行所示。相反,以下标记有效并且不会牺牲可读性,IMO:
<ui-select ng-model="formula.value" theme="bootstrap">
<ui-select-match>{{ $select.selected }}</ui-select-match>
<ui-select-choices repeat="choice in ['AND', 'OR']">
<span>{{ choice }}</span>
</ui-select-choices>
</ui-select>
我需要向 ui-select
添加两个选项,而不是使用重复和数组,我认为如果将它们标记在 <ui-select-choices>
中,代码会更清晰(请参见下面的示例)。但它不起作用,如果这在某种程度上可能,有什么想法吗?
<ui-select ng-model="formula.value">
<ui-select-match>
<span ng-bind="$select.selected.name"></span>
</ui-select-match>
<ui-select-choices>
<span>AND</span>
<span>OR</span>
</ui-select-choices>
</ui-select>
这是不可能的,因为 ui-select-choices
需要 repeat
属性,如 the source 中的第 21 行所示。相反,以下标记有效并且不会牺牲可读性,IMO:
<ui-select ng-model="formula.value" theme="bootstrap">
<ui-select-match>{{ $select.selected }}</ui-select-match>
<ui-select-choices repeat="choice in ['AND', 'OR']">
<span>{{ choice }}</span>
</ui-select-choices>
</ui-select>