Angularjs : add multiple ng_if condition in with haml syntax

274 Views Asked by At

I'm working on an item_selector directive, I want to add an indicator for archived element, this is the item selector template .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 }}

I've add a through line css propoerty to archived element by :

%span{'ng': {'class': "{'is-archived': $select.selected.object.is_archived === true}"}}
   {{ $select.selected.label }

and I want to add a mouse hover indicator that tell user "this element is archived", I thought about ng_if multiple condition in this attribute of ui_select.ui-select : title: "{{ $select.selected.label }}"

*

if $select.selected.object.is_archived return true : costume message else {{ $select.selected.label }

*

0

There are 0 best solutions below