How to define list sliding options dynamically?


#1

I need to display different sliding options depending on some settings in list item’s model. Conceptually would be something similar to:

  <ion-list>
    <ion-item-sliding #slidingItem>
      <ion-item *ngFor="let todo of todos">
        {{todo.action}}
      </ion-item>
      <ion-item-options>
        <button *ngIf="todo.action == 'action1" 
          (click)="doAction(todo.action, slidingItem)">
            {{todo.action.text}}
        </button>
        <button *ngIf="todo.action == 'action2" 
          (click)="doAction(todo.action, slidingItem)">
            {{todo.action.text}}
        </button>
      </ion-item-options>
    </ion-item-sliding>
  </ion-list>

Added reference to sliding item, but ItemSliding only offers close() method to hide the sliding option. How can I access list item model in item options?

Thanks in advance.