Ionic 4 ion-item-sliding cannot closed by api


Hi, I am using ion-item-sliding and i want it to be close after i click the button. However i try to use IonItemSliding.close() to close the ion-item-sliding, but it said
ERROR Error: Uncaught (in promise): TypeError: item.close is not a function TypeError: item.close is not a function

Below is my code

<ion-item-sliding *ngFor="let item of items">
    <ion-item-options #item side="end">
            <ion-item-option (click)="unread(item.status, item)">click me</ion-item-option>
import { IonItemSliding } from '@ionic/angular';
unread(s, item: IonItemSliding){


This is my reference from ionic 3


I think you should put the ID in the ion-item sliding not on the ion-item-sliding-option or try to rename your *ngFor variable or the ID.

Hope this helps.


Not sure why but what i did is now added the index and let it be the ID, then the thing is working now.

Maybe related to my item is an object but i also try but thing is not work with the item id.

Below is the solution for me.

<ion-item-sliding *ngFor="let item of items;  let i = index" #i>