如果项目选择器变量为true,则AngularJS添加css类
我有一个item selector指令,我想为所选项目添加一个测试:如果它已存档,我必须添加一个css类如果项目选择器变量为true,则AngularJS添加css类,css,angularjs,class,itemselector,Css,Angularjs,Class,Itemselector,我有一个item selector指令,我想为所选项目添加一个测试:如果它已存档,我必须添加一个css类 .directive-items-selector{ ng_click: "openItemsSelector( $event )" } .wrapper %ui_select.ui-select{ ng: { model: "input.model", disabled: "disabled", change:
.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' }
{{ $select.selected.label }}
{{$select.selected.object.is_archived}}
%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 }}
{{$select.selected.object.is_archived}返回true如果项目已存档,我不知道如何添加此css类!任何帮助您可以像这样使用ng class指令:
ng class=“{'class-false':selected.object.is_存档,'class true':}”