我正在研究 item_selector 指令,我想为归档元素添加一个指示符,这是项目选择器模板 .haml :
.directive-items-selector{ ng_click: "openItemsSelector( $event )" }
.wrapper
%ui_select.ui-select{ ng: { model: "input.model", disabled: "disabled",
change: "itemSelectModelChanged()" },
search_enabled: "{{ options.searchable }}" }
%ui_select_match.ui-select-match{ items_selector_match: '',
placeholder: "{{ input.placeholder }} ",
allow_clear: "{{ options.clearable }}",
title: "{{ $select.selected.label }}" }
%i.fa{ ng_class: 'icon' }
%span{'ng': {'class': "{'is-archived': $select.selected.object.is_archived === true}"}}
{{ $select.selected.label }}
%ui_select_choices.ui-select-choices{ repeat: "item.id as item in input.filteredItems track by item.id",
refresh: "reloadItems( $select.search )",
refresh_delay: '{{ input.filterDelay }}' }
.item{ ng_attr_title: "{{ ::item.label }}" }
.item-label {{ ::item.label }}
%small.item-details {{ ::item.details }}
.items-selector-actions
%a.pointer.action{ ng: { if: 'linkToModal', click: 'openDetails()', disabled: "!model" }}
{{ 'btn.details' | translate }}
%a.pointer.action{ ng: { if: 'createButton && klassName && !disabled', click: 'createItem()' }}
{{ 'btn.new' | translate }}
我已通过以下方式将直通 css 属性添加到存档元素:
%span{'ng': {'class': "{'is-archived': $select.selected.object.is_archived === true}"}}
{{ $select.selected.label }
我想添加一个鼠标悬停指示器,告诉用户“此元素已存档”,我在 ui_select.ui-select 的此属性中考虑了 ng_if 多个条件:标题:“{{ $select.selected.label }}”
*
if $select.selected.object.is_archived return true : 服装信息 else {{ $select.selected.label }
*